Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -16,6 +16,8 @@ import aiohttp
|
|
| 16 |
from aiohttp.resolver import AsyncResolver
|
| 17 |
import utils
|
| 18 |
|
|
|
|
|
|
|
| 19 |
# Setup Discord bot
|
| 20 |
logging.basicConfig(level=logging.INFO)
|
| 21 |
intents = discord.Intents.default()
|
|
@@ -40,9 +42,11 @@ async def main():
|
|
| 40 |
print(f"Logged in as {bot.user} (ID: {bot.user.id})")
|
| 41 |
synced = await bot.tree.sync()
|
| 42 |
print(f"Synced commands: {', '.join([s.name for s in synced])}.")
|
| 43 |
-
|
| 44 |
print("------")
|
| 45 |
-
|
|
|
|
|
|
|
| 46 |
|
| 47 |
@bot.hybrid_command(
|
| 48 |
name="echo",
|
|
@@ -50,17 +54,17 @@ async def main():
|
|
| 50 |
)
|
| 51 |
async def echo(ctx,*,input_text):
|
| 52 |
try:
|
| 53 |
-
await
|
| 54 |
# 调用 Gradio 应用 API
|
| 55 |
result = client.predict(
|
| 56 |
message=input_text,
|
| 57 |
api_name="/slow_echo"
|
| 58 |
)
|
| 59 |
-
await
|
| 60 |
|
| 61 |
return result
|
| 62 |
except Exception as e:
|
| 63 |
-
await
|
| 64 |
return f"Erreur:{e}"
|
| 65 |
|
| 66 |
@bot.event
|
|
|
|
| 16 |
from aiohttp.resolver import AsyncResolver
|
| 17 |
import utils
|
| 18 |
|
| 19 |
+
event = Event()
|
| 20 |
+
|
| 21 |
# Setup Discord bot
|
| 22 |
logging.basicConfig(level=logging.INFO)
|
| 23 |
intents = discord.Intents.default()
|
|
|
|
| 42 |
print(f"Logged in as {bot.user} (ID: {bot.user.id})")
|
| 43 |
synced = await bot.tree.sync()
|
| 44 |
print(f"Synced commands: {', '.join([s.name for s in synced])}.")
|
| 45 |
+
event.set()
|
| 46 |
print("------")
|
| 47 |
+
|
| 48 |
+
async def response(input_text):
|
| 49 |
+
return "fine"
|
| 50 |
|
| 51 |
@bot.hybrid_command(
|
| 52 |
name="echo",
|
|
|
|
| 54 |
)
|
| 55 |
async def echo(ctx,*,input_text):
|
| 56 |
try:
|
| 57 |
+
await ctx.channel.send("toto")
|
| 58 |
# 调用 Gradio 应用 API
|
| 59 |
result = client.predict(
|
| 60 |
message=input_text,
|
| 61 |
api_name="/slow_echo"
|
| 62 |
)
|
| 63 |
+
await ctx.channel.send(f"yeah right lmfao 🥀🥀")
|
| 64 |
|
| 65 |
return result
|
| 66 |
except Exception as e:
|
| 67 |
+
await ctx.channel.send("issueo")
|
| 68 |
return f"Erreur:{e}"
|
| 69 |
|
| 70 |
@bot.event
|