Update app.py
Browse files
app.py
CHANGED
|
@@ -8,7 +8,6 @@ import re
|
|
| 8 |
from threading import Thread
|
| 9 |
from pathlib import Path
|
| 10 |
|
| 11 |
-
|
| 12 |
import discord
|
| 13 |
from discord.ext import commands
|
| 14 |
import gradio as gr
|
|
@@ -19,15 +18,12 @@ from typing import Dict, List
|
|
| 19 |
|
| 20 |
from utils import *
|
| 21 |
|
| 22 |
-
|
| 23 |
lock = asyncio.Lock()
|
| 24 |
|
| 25 |
bot = commands.Bot("", intents=discord.Intents(messages=True, guilds=True))
|
| 26 |
|
| 27 |
-
|
| 28 |
GUILD_SPACES_FILE = "guild_spaces.pkl"
|
| 29 |
|
| 30 |
-
|
| 31 |
if pathlib.Path(GUILD_SPACES_FILE).exists():
|
| 32 |
guild_spaces = read_pickle_file(GUILD_SPACES_FILE)
|
| 33 |
assert isinstance(guild_spaces, dict), f"{GUILD_SPACES_FILE} in invalid format."
|
|
@@ -44,7 +40,6 @@ else:
|
|
| 44 |
guild_spaces: Dict[int, str] = {}
|
| 45 |
guild_blocks: Dict[int, gr.Blocks] = {}
|
| 46 |
|
| 47 |
-
|
| 48 |
HASHED_USERS_FILE = "users.pkl"
|
| 49 |
|
| 50 |
if pathlib.Path(HASHED_USERS_FILE).exists():
|
|
@@ -180,7 +175,7 @@ bot.env = "prod" # type: ignore
|
|
| 180 |
bot.name = "GradioBot" # type: ignore
|
| 181 |
|
| 182 |
|
| 183 |
-
t = Thread(target=bot.run, daemon=True, args=(os.getenv("discord_token"),
|
| 184 |
t.start()
|
| 185 |
|
| 186 |
import gradio as gr
|
|
|
|
| 8 |
from threading import Thread
|
| 9 |
from pathlib import Path
|
| 10 |
|
|
|
|
| 11 |
import discord
|
| 12 |
from discord.ext import commands
|
| 13 |
import gradio as gr
|
|
|
|
| 18 |
|
| 19 |
from utils import *
|
| 20 |
|
|
|
|
| 21 |
lock = asyncio.Lock()
|
| 22 |
|
| 23 |
bot = commands.Bot("", intents=discord.Intents(messages=True, guilds=True))
|
| 24 |
|
|
|
|
| 25 |
GUILD_SPACES_FILE = "guild_spaces.pkl"
|
| 26 |
|
|
|
|
| 27 |
if pathlib.Path(GUILD_SPACES_FILE).exists():
|
| 28 |
guild_spaces = read_pickle_file(GUILD_SPACES_FILE)
|
| 29 |
assert isinstance(guild_spaces, dict), f"{GUILD_SPACES_FILE} in invalid format."
|
|
|
|
| 40 |
guild_spaces: Dict[int, str] = {}
|
| 41 |
guild_blocks: Dict[int, gr.Blocks] = {}
|
| 42 |
|
|
|
|
| 43 |
HASHED_USERS_FILE = "users.pkl"
|
| 44 |
|
| 45 |
if pathlib.Path(HASHED_USERS_FILE).exists():
|
|
|
|
| 175 |
bot.name = "GradioBot" # type: ignore
|
| 176 |
|
| 177 |
|
| 178 |
+
t = Thread(target=bot.run, daemon=True, args=(os.getenv("discord_token"),))
|
| 179 |
t.start()
|
| 180 |
|
| 181 |
import gradio as gr
|