makes bot reply to quotes of its own messages in a group

This commit is contained in:
root
2023-03-22 12:00:05 +00:00
parent 7e6720f657
commit f9cb4faf19

View File

@@ -294,6 +294,9 @@ class ChatGPT3TelegramBot:
trigger_keyword = self.config['group_trigger_keyword']
if prompt.startswith(trigger_keyword):
prompt = prompt[len(trigger_keyword):].strip()
else:
if update.message.reply_to_message and update.message.reply_to_message.from_user.id == context.bot.id:
logging.info('Message is a reply to the bot, allowing...')
else:
logging.warning('Message does not start with trigger keyword, ignoring...')
return