Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -36,15 +36,7 @@ intents = discord.Intents.default()
|
|
| 36 |
intents.message_content = True
|
| 37 |
intents.members = True
|
| 38 |
bot = commands.Bot(intents=intents, connector=connector, command_prefix="!")
|
| 39 |
-
|
| 40 |
-
async def main():
|
| 41 |
-
# Setup DNS resolver to avoid potential issues
|
| 42 |
-
resolver = AsyncResolver(nameservers=["1.1.1.1", "8.8.8.8"])
|
| 43 |
-
connector = aiohttp.TCPConnector(resolver=resolver)
|
| 44 |
-
client = Client("https://standarovskid-bot.hf.space/", token=HF_TOKEN)
|
| 45 |
-
|
| 46 |
-
|
| 47 |
-
|
| 48 |
@bot.event
|
| 49 |
async def on_ready():
|
| 50 |
print(f"Logged in as {bot.user} (ID: {bot.user.id})")
|
|
@@ -55,6 +47,11 @@ async def on_ready():
|
|
| 55 |
|
| 56 |
@bot.command()
|
| 57 |
async def test(ctx, *, arg):
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 58 |
await ctx.send(arg)
|
| 59 |
|
| 60 |
# running in thread
|
|
|
|
| 36 |
intents.message_content = True
|
| 37 |
intents.members = True
|
| 38 |
bot = commands.Bot(intents=intents, connector=connector, command_prefix="!")
|
| 39 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 40 |
@bot.event
|
| 41 |
async def on_ready():
|
| 42 |
print(f"Logged in as {bot.user} (ID: {bot.user.id})")
|
|
|
|
| 47 |
|
| 48 |
@bot.command()
|
| 49 |
async def test(ctx, *, arg):
|
| 50 |
+
thread = await ctx.create_thread(name=prompt, auto_archive_duration=60)
|
| 51 |
+
loop = asyncio.get_running_loop()
|
| 52 |
+
client = await loop.run_in_executor(None, get_client, None)
|
| 53 |
+
job = client.submit(prompt, api_name="/slow_echo")
|
| 54 |
+
wait([job])
|
| 55 |
await ctx.send(arg)
|
| 56 |
|
| 57 |
# running in thread
|