feat/add-argument-priority-for-the-ai-command-handler

This commit is contained in:
parent 8bf781b67d
commit 0b9603d9f2

View File

@ -56,9 +56,13 @@ class TelegramUserBot:
# Extract the command argument
command_arg: Optional[str] = " ".join(message.text.split()[1:])
if not command_arg and message.reply_to_message and message.reply_to_message.text:
# Use the text of the replied message if no argument is provided
command_arg = message.reply_to_message.text
if not command_arg:
self.logger.warning(f"No argument provided for /ai command by chat_id={message.chat.id}")
await message.reply_text("Please provide a message after /ai.")
self.logger.warning(f"No argument or replied message provided for /ai command by chat_id={message.chat.id}")
await message.reply_text("Please provide a message after /ai or reply to a message.")
return
# Send an initial message indicating processing