Folder

class pyrogram.types.Folder

Bases: Object

A user’s folder.

Parameters:
  • id (int) – The folder id.

  • title (str) – The folder title.

  • title_entities (List of MessageEntity, optional) – A list of entities in the folder title.

  • included_chats (List of Chat, optional) – A list of included chats in folder.

  • excluded_chats (List of Chat, optional) – A list of excluded chats in folder.

  • pinned_chats (List of Chat, optional) – A list of pinned chats in folder.

  • contacts (bool, optional) – True, if the folder includes contacts.

  • non_contacts (bool, optional) – True, if the folder includes non contacts.

  • groups (bool, optional) – True, if the folder includes groups.

  • channels (bool, optional) – True, if the folder includes channels.

  • bots (bool, optional) – True, if the folder includes bots.

  • exclude_muted (bool, optional) – True, if the folder exclude muted.

  • exclude_read (bool, optional) – True, if the folder exclude read.

  • exclude_archived (bool, optional) – True, if the folder exclude archived.

  • emoji (str, optional) – Folder emoji.

  • color (FolderColor, optional) – Chat reply color.

update(included_chats=None, excluded_chats=None, pinned_chats=None, title=None, contacts=None, non_contacts=None, groups=None, channels=None, bots=None, exclude_muted=None, exclude_read=None, exclude_archived=None, emoji=None, color=None)

Bound method update_peers of Folder.

Use as a shortcut for:

await client.update_folder(
    folder_id,
    title="New folder",
    included_chats=["me"]
)

Example

await folder.update(included_chats=["me"])
Parameters:
  • included_chats (int | str | List of int or str, optional) – Users or chats that should added in the folder You can pass an ID (int), username (str) or phone number (str). Multiple users can be added by passing a list of IDs, usernames or phone numbers.

  • excluded_chats (int | str | List of int or str, optional) – Users or chats that should excluded from the folder You can pass an ID (int), username (str) or phone number (str). Multiple users can be added by passing a list of IDs, usernames or phone numbers.

  • pinned_chats (int | str | List of int or str, optional) – Users or chats that should pinned in the folder You can pass an ID (int), username (str) or phone number (str). Multiple users can be added by passing a list of IDs, usernames or phone numbers.

  • title (str, optional) – A folder title was changed to this value.

  • contacts (bool, optional) – Pass True if folder should contain contacts.

  • non_contacts (bool, optional) – Pass True if folder should contain non contacts.

  • groups (bool, optional) – Pass True if folder should contain groups.

  • channels (bool, optional) – Pass True if folder should contain channels.

  • bots (bool, optional) – Pass True if folder should contain bots.

  • exclude_muted (bool, optional) – Pass True if folder should exclude muted users.

  • exclude_archived (bool, optional) – Pass True if folder should exclude archived users.

  • emoji (str, optional) – Folder emoji. Pass None to leave the folder icon as default.

  • color (FolderColor, optional) – Color type. Pass FolderColor to set folder color.

Returns:

True on success.

include_chat(chat_id)

Bound method include_chat of Folder.

Use as a shortcut for:

await client.update_folder(
    folder_id=123456789,
    included_chats=[chat_id],
    excluded_chats=[...],
    pinned_chats=[...]
)

Example

await folder.include_chat(chat_id)
Parameters:

chat_id (int | str) – Unique identifier for the target chat or username of the target user/channel/supergroup (in the format @username).

Returns:

True on success.

exclude_chat(chat_id)

Bound method exclude_chat of Folder.

Use as a shortcut for:

await client.update_folder(
    folder_id=123456789,
    included_chats=[...],
    excluded_chats=[chat_id],
    pinned_chats=[...]
)

Example

await folder.exclude_chat(chat_id)
Parameters:

chat_id (int | str) – Unique identifier for the target chat or username of the target user/channel/supergroup (in the format @username).

Returns:

True on success.

update_color(color)

Bound method update_color of Folder.

Use as a shortcut for:

await client.update_folder(
    folder_id=123456789,
    included_chats=[chat_id],
    excluded_chats=[chat_id],
    pinned_chats=[...],
    color=color
)

Example

await folder.update_color(enums.FolderColor.RED)
Parameters:

color (FolderColor, optional) – Color type. Pass FolderColor to set folder color.

Returns:

True on success.

pin_chat(chat_id)

Bound method pin_chat of Folder.

Use as a shortcut for:

await client.update_folder(
    folder_id=123456789,
    included_chats=[chat_id],
    excluded_chats=[chat_id],
    pinned_chats=[...]
)

Example

await folder.pin_chat(chat_id)
Parameters:

chat_id (int | str) – Unique identifier for the target chat or username of the target user/channel/supergroup (in the format @username).

Returns:

True on success.

remove_chat(chat_id)

Bound method remove_chat of Folder.

Remove chat from included, excluded and pinned chats.

Use as a shortcut for:

await client.update_folder(
    folder_id=123456789,
    included_chats=[...],
    excluded_chats=[...],
    pinned_chats=[...]
)

Example

await folder.remove_chat(chat_id)
Parameters:

chat_id (int | str) – Unique identifier for the target chat or username of the target user/channel/supergroup (in the format @username).

Returns:

True on success.