diff --git a/src/bot/telegram_userbot.py b/src/bot/telegram_userbot.py index fe69355..4084c56 100644 --- a/src/bot/telegram_userbot.py +++ b/src/bot/telegram_userbot.py @@ -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