My telegram bot works in chat groups and saves known user data and assigns a group ID to it. When the group type changes, the ID of the group also changes, so the code cannot find the corresponding users in the database.
I checked the aiogram documentation for the current version and didn't find anything useful, but I found some solutions on python-telegram-bot:
def migchat(bot, update):
oldchatid = update.message.migrate_from_chat_id
newchatid = update.message.chat.id
# code access db to change id's.
dispatcher.add_handler(MessageHandler(Filters.status_update.migrate, migchat))
But I don’t understand at all how this can be implemented on aiogram. Have you encountered a similar situation?
I found a solution to the problem by reading the documentation on the Telegram API and aiogram. We can use a message hendler with a certain content type. The solution is attached below, it instantly registers the migration and proceeds from there.
If that didn't work for you, I suggest reading about how telegram works here, and about aiogram here.