create_folder()

Client.create_folder()

Create new chat folder.

Usable by Users Bots
Parameters:
  • name (str) – The text of the chat folder name, 1-12 characters without line feeds.

  • parse_mode (ParseMode, optional) – By default, texts are parsed using both Markdown and HTML styles. You can combine both syntaxes together.

  • entities (List of MessageEntity, optional) – Special entities like bold, italic, etc. that appear in the folder name.

  • animate_custom_emoji (bool, optional) – True, if custom emoji in the name must be animated.

  • icon (str, optional) – The chosen icon for the chat folder. Pass None to leave the folder icon as default.

  • color (FolderColor, optional) – Pass FolderColor to set folder color. Can’t be changed if folder tags are disabled or the current user doesn’t have Telegram Premium subscription.

  • is_shareable (bool, optional) – True, if at least one link has been created for the folder.

  • pinned_chats (List of Chat, optional) – The pinned chats in the folder. You can pass an ID (int), username (str) or phone number (str). There can be up to getOption(“chat_folder_chosen_chat_count_max”) pinned and always included non-secret chats and the same number of secret chats, but the limit can be increased with Telegram Premium.

  • included_chats (List of Chat, optional) – The always included chats in the folder. You can pass an ID (int), username (str) or phone number (str). There can be up to getOption(“chat_folder_chosen_chat_count_max”) pinned and always included non-secret chats and the same number of secret chats, but the limit can be increased with Telegram Premium.

  • excluded_chats (List of Chat, optional) – The always excluded chats in the folder. You can pass an ID (int), username (str) or phone number (str). There can be up to getOption(“chat_folder_chosen_chat_count_max”) always excluded non-secret chats and the same number of secret chats, but the limit can be increased with Telegram Premium.

  • exclude_muted (bool, optional) – True, if muted chats need to be excluded.

  • exclude_read (bool, optional) – True, if read chats need to be excluded.

  • exclude_archived (bool, optional) – True, if archived chats need to be excluded.

  • include_contacts (bool, optional) – True, if contacts need to be included.

  • include_non_contacts (bool, optional) – True, if non-contact users need to be included.

  • include_bots (bool, optional) – True, if bots need to be included.

  • include_groups (bool, optional) – True, if basic groups and supergroups need to be included.

  • include_channels (bool, optional) – True, if channels need to be included.

Returns:

int – On success, folder id is returned.

Example

# Create folder
await app.create_folder(name="New folder", included_chats=["me"])