Spaces:
Runtime error
Runtime error
Refactor message responses to use reply instead of channel send
Browse files- bot/discord_bot.py +3 -3
bot/discord_bot.py
CHANGED
@@ -67,16 +67,16 @@ async def on_message(message: discord.Message) -> None:
|
|
67 |
docs = await _handle_attachments(chat, message)
|
68 |
if docs:
|
69 |
info = "\n".join(f"{name} -> {path}" for name, path in docs)
|
70 |
-
await message.
|
71 |
|
72 |
if message.content.strip():
|
73 |
try:
|
74 |
reply = await chat.chat(message.content)
|
75 |
except Exception as exc: # pragma: no cover - runtime errors
|
76 |
_LOG.error("Failed to process message: %s", exc)
|
77 |
-
await message.
|
78 |
else:
|
79 |
-
await message.
|
80 |
|
81 |
|
82 |
def main() -> None:
|
|
|
67 |
docs = await _handle_attachments(chat, message)
|
68 |
if docs:
|
69 |
info = "\n".join(f"{name} -> {path}" for name, path in docs)
|
70 |
+
await message.reply(f"Uploaded:\n{info}", mention_author=False)
|
71 |
|
72 |
if message.content.strip():
|
73 |
try:
|
74 |
reply = await chat.chat(message.content)
|
75 |
except Exception as exc: # pragma: no cover - runtime errors
|
76 |
_LOG.error("Failed to process message: %s", exc)
|
77 |
+
await message.reply(f"Error: {exc}", mention_author=False)
|
78 |
else:
|
79 |
+
await message.reply(reply, mention_author=False)
|
80 |
|
81 |
|
82 |
def main() -> None:
|