mirror of
https://github.com/aljazceru/chatgpt-telegram-bot.git
synced 2026-01-08 15:35:44 +01:00
Merge pull request #298 from stanislavlysenko0912/reply-messages
Add support for quoting replied messages
This commit is contained in:
@@ -401,6 +401,14 @@ class ChatGPTTelegramBot:
|
||||
trigger_keyword = self.config['group_trigger_keyword']
|
||||
if prompt.lower().startswith(trigger_keyword.lower()):
|
||||
prompt = prompt[len(trigger_keyword):].strip()
|
||||
|
||||
if update.message.reply_to_message and \
|
||||
update.message.reply_to_message.text and \
|
||||
update.message.reply_to_message.from_user.id != context.bot.id:
|
||||
prompt = '"{reply}" {prompt}'.format(
|
||||
reply=update.message.reply_to_message.text,
|
||||
prompt=prompt
|
||||
)
|
||||
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...')
|
||||
|
||||
Reference in New Issue
Block a user