Skip to content

Handling migration to supergroup #1682

Description

@evgensetrov
  1. What version of pyTelegramBotAPI are you using? 4.6.0

  2. What OS are you using? Windows 11 & Ubuntu 20.04

  3. What version of python are you using? 3.8

Hi! When a group is migrated to a supergroup, the chat.id changes, for example: it was -685960703, became -1001502049385. At the time of migration, the bot receives two updates - message objects with the migrate_to_chat_id and migrate_from_chat_id fields, however, using the message_handler decorator, these updates cannot be caught.
image

Since chat.id is written to the database for further filtering of messages, I need to somehow catch the moment the chat.id changes. Any ideas? Thanks!

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions