Skip to content

Commit

Permalink
The "info" command does not delete messages
Browse files Browse the repository at this point in the history
  • Loading branch information
yym68686 committed Dec 7, 2023
1 parent c8690c8 commit a01263e
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions bot.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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):
Expand Down
2 changes: 1 addition & 1 deletion config.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down

0 comments on commit a01263e

Please sign in to comment.