From a01263e7f9d3b0d973de995b7ecdc92fa76849fa Mon Sep 17 00:00:00 2001 From: yym68686 Date: Thu, 7 Dec 2023 21:33:50 +0800 Subject: [PATCH] The "info" command does not delete messages --- bot.py | 6 +++--- config.py | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/bot.py b/bot.py index fe83dc2a..ac9a2c5b 100644 --- a/bot.py +++ b/bot.py @@ -32,7 +32,7 @@ translator_prompt = "You are a translation engine, you can only translate text and cannot interpret it, and do not explain. Translate the text to {}, please do not explain any sentences, just translate or leave them as they are. this is the content you need to translate: " @decorators.Authorization async def command_bot(update, context, language=None, prompt=translator_prompt, title="", robot=None, has_command=True): - if config.PRIVATECHAT and update.message.chat.type == "private": + if not config.ALLOWPRIVATECHAT and update.message.chat.type == "private": return if has_command == False or len(context.args) > 0: message = update.message.text if config.NICK is None else update.message.text[botNicKLength:].strip() if update.message.text[:botNicKLength].lower() == botNick else None @@ -487,8 +487,8 @@ async def info(update, context): ) message = await context.bot.send_message(chat_id=update.message.chat_id, text=escape(info_message), reply_markup=InlineKeyboardMarkup(first_buttons), parse_mode='MarkdownV2', disable_web_page_preview=True) - messageid = message.message_id - await context.bot.delete_message(chat_id=update.effective_chat.id, message_id=update.message.message_id) + # messageid = message.message_id + # await context.bot.delete_message(chat_id=update.effective_chat.id, message_id=update.message.message_id) @decorators.Authorization async def handle_pdf(update, context): diff --git a/config.py b/config.py index 4310e308..d34f7eeb 100644 --- a/config.py +++ b/config.py @@ -15,7 +15,7 @@ API_URL = os.environ.get('API_URL', 'https://api.openai.com/v1/chat/completions') PDF_EMBEDDING = (os.environ.get('PDF_EMBEDDING', "True") == "False") == False LANGUAGE = os.environ.get('LANGUAGE', 'Simplified Chinese') -PRIVATECHAT = (os.environ.get('PRIVATECHAT', "True") == "False") == False +ALLOWPRIVATECHAT = (os.environ.get('ALLOWPRIVATECHAT', "True") == "False") == False from datetime import datetime current_date = datetime.now()