minchyeom commited on
Commit
e5f45cd
·
1 Parent(s): 5c99214

Refactor message responses to use reply instead of channel send

Browse files
Files changed (1) hide show
  1. 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.channel.send(f"Uploaded:\n{info}")
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.channel.send(f"Error: {exc}")
78
  else:
79
- await message.channel.send(reply)
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: