Answer the question
In order to leave comments, you need to log in
How to turn on and off part of the code in a telegram bot?
def sticker_recived(bot, update):
admins = [admin.user.id for admin in bot.get_chat_administrators(chat_id=update.message.chat_id)]
if update.message.from_user.id not in admins:
bot.delete_message(chat_id=update.message.chat_id, message_id=update.message.message_id)
Answer the question
In order to leave comments, you need to log in
I would hang a global flag (bool) that would change according to /on and /off , and put a condition on the code execution.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question