I have created a bot to manage my group in telegram using python-telegram-bot
. I would like the bot to handle and remove joined/left messages. I am not getting those messages as regular ones. Is there any way to handle them?
I used a bot to do the task for me but this bot started to post ads. I don't trust any existing bots and I would like to create mine using python-telegram-bot
since my bot is already built using it.
I have solved the issue as follows:
Joined messages can be handled using Filters.status_update.new_chat_members
The following is my code.
def onjoin(update,context):
context.bot.delete_message(chat_id=update.message.chat_id,message_id=update.message.message_id)
def main():
updater = Updater(API_KEY, use_context=True)
dp = updater.dispatcher
dp.add_handler(MessageHandler(Filters.status_update.new_chat_members,onjoin))