mirror of
https://github.com/aljazceru/chatgpt-telegram-bot.git
synced 2025-12-23 23:55:05 +01:00
Simplifying the code for the message reply
This commit is contained in:
committed by
GitHub
parent
8d40ae7b42
commit
4b15bafb9e
@@ -371,14 +371,9 @@ class ChatGPTTelegramBot:
|
||||
if is_group_chat(update):
|
||||
trigger_keyword = self.config['group_trigger_keyword']
|
||||
|
||||
raw_text = update.message.text.lower()
|
||||
prompt_lower = prompt.lower()
|
||||
|
||||
if raw_text.startswith('/chat') or prompt_lower.startswith(trigger_keyword):
|
||||
if not prompt_lower.startswith(trigger_keyword):
|
||||
prompt = f'{trigger_keyword} {prompt}'
|
||||
|
||||
prompt = prompt[len(trigger_keyword):].strip()
|
||||
if prompt.lower().startswith(trigger_keyword.lower()) or update.message.text.lower().startswith('/chat'):
|
||||
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 \
|
||||
|
||||
Reference in New Issue
Block a user