Supergroups in Telegram
When you use Telegram, you deal with groups regularly. The truth is that what looks like groups in Telegram UI is actually two kinds of entities: groups and supergroups.
What are supergroups
A long time ago, Telegram developers introduced two types of groups: regular ones and supergroups. Supergroups had public links, larger limit for the number of members, and other features designed for big communities.
Apparently, this idea has later been considered rather confusing. Telegram app interface no longer mentions "supergroups" and all groups look the same there, although on the technical level two types remain distinguish. In fact, most of the groups you participate in are probably supergroups.
The main trait of supergroups is that API considers them a special case of channels.
if chat.type == ChatType.SUPERGROUP:
print('This is a supergroup')
if chat.type == ChatType.CHANNEL:
print('This is a real channel')
if chat.type == ChatType.GROUP:
print('This is an old-type group')
if chat.type == ChatType.PRIVATE:
print('This is PM')
I use the term "groups" both for regular groups and supergroups in this book. For more info about group bots, see the page about groups.
Turning into a supergroup
A regular group becomes a supergroup while certain settings are changed. As technically the group is replaced with a supegroup (which is a new channel), its chat ID changes. You may want to handle this event if you store the chats in a database:
@dp.message(F.migrate_to_chat_id)
async def migrated(message: Message):
print(f'{message.chat.title} became a supergroup')
A supergroup cannot become a regular group again.
Message and group IDs
On the next page we will discuss how group IDs are different for groups and supergroups in Bot API. In addition, regular groups and supergroups are different in terms of how message ID work as discussed in Message IDs.
Gigagroups (broadcast groups)
Gigagroups are yet another type of groups in Telegram. They are very rare though, so this is just FYI.
A maximal number of supergroup members is 200.000. When it's close to the limit, Telegram app suggests admins turn the supergroup into a gigagroup. Gigagroups may contain an unlimited number of members, but only admins can send messages there.
I have no idea why they exist.