Skip to content

Commit

Permalink
disable web page preview
Browse files Browse the repository at this point in the history
  • Loading branch information
n3d1117 committed Dec 7, 2022
1 parent 7f5deae commit 77ab1d4
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions telegram_bot.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,14 @@ def __init__(self, config, gpt3_bot):
# Help menu
async def help(self, update: Update, context: ContextTypes.DEFAULT_TYPE) -> None:
await update.message.reply_text("/start - Start the bot\n/reset - Reset conversation\n/help - Help menu\n\n"
"Open source at https://github.com/n3d1117/chatgpt-telegram-bot")
"Open source at https://github.com/n3d1117/chatgpt-telegram-bot",
disable_web_page_preview=True)

# Start the bot
async def start(self, update: Update, context: ContextTypes.DEFAULT_TYPE):
if not self.is_allowed(update):
logging.info(f'User {update.message.from_user.name} is not allowed to start the bot')
await context.bot.send_message(chat_id=update.effective_chat.id, text=self.disallowed_message)
await context.bot.send_message(chat_id=update.effective_chat.id, text=self.disallowed_message, disable_web_page_preview=True)
return

logging.info('Bot started')
Expand All @@ -31,7 +32,7 @@ async def start(self, update: Update, context: ContextTypes.DEFAULT_TYPE):
async def reset(self, update: Update, context: ContextTypes.DEFAULT_TYPE):
if not self.is_allowed(update):
logging.info(f'User {update.message.from_user.name} is not allowed to reset the bot')
await context.bot.send_message(chat_id=update.effective_chat.id, text=self.disallowed_message)
await context.bot.send_message(chat_id=update.effective_chat.id, text=self.disallowed_message, disable_web_page_preview=True)
return

logging.info('Resetting the conversation...')
Expand All @@ -42,7 +43,7 @@ async def reset(self, update: Update, context: ContextTypes.DEFAULT_TYPE):
async def prompt(self, update: Update, context: ContextTypes.DEFAULT_TYPE):
if not self.is_allowed(update):
logging.info(f'User {update.message.from_user.name} is not allowed to use the bot')
await context.bot.send_message(chat_id=update.effective_chat.id, text=self.disallowed_message)
await context.bot.send_message(chat_id=update.effective_chat.id, text=self.disallowed_message, disable_web_page_preview=True)
return

logging.info(f'New message received from user {update.message.from_user.name}')
Expand Down

0 comments on commit 77ab1d4

Please sign in to comment.