On Telegram, every group has a chat-id
that my bot saves whenever it is added to a group.
If an owner of a group converts it to a supergroup, will the I
After testing it out for myself, the chat-id
does change on migration to a supergroup.
However I found the following way, using python-telegram-bot
to keep your chat-ids updated:
def migchat(bot, update):
oldchatid = update.message.migrate_from_chat_id
newchatid = update.message.chat.id
# process those values as needed (e.g. update a database)
dispatcher.add_handler(MessageHandler(Filters.status_update.migrate, migchat))
This uses the Filters submodule to call migchat
whenever a chat is being migrated.
This is how the JSON response of the message from the /getUpdates
call looks like: