telegram.chat module

This module contains an object that represents a Telegram Chat.

class telegram.chat.Chat(id, type, title=None, username=None, first_name=None, last_name=None, all_members_are_administrators=None, bot=None, **kwargs)

Bases: telegram.base.TelegramObject

This object represents a Telegram Chat.

id

int

type

str – Can be ‘private’, ‘group’, ‘supergroup’ or ‘channel’

title

str – Title, for channels and group chats

username

str – Username, for private chats and channels if available

first_name

str – First name of the other party in a private chat

last_name

str – Last name of the other party in a private chat

all_members_are_administrators

bool – True if group has ‘All Members Are Administrators’

Parameters:
  • id (int) –
  • type (str) –
  • title (Optional[str]) –
  • username (Optional[str]) –
  • first_name (Optional[str]) –
  • last_name (Optional[str]) –
  • bot (Optional[Bot]) – The Bot to use for instance methods
  • **kwargs (dict) – Arbitrary keyword arguments.
CHANNEL = 'channel'
GROUP = 'group'
PRIVATE = 'private'
SUPERGROUP = 'supergroup'
static de_json(data, bot)
Parameters:
Returns:

Return type:

telegram.Chat

get_administrators(*args, **kwargs)

Shortcut for bot.getChatAdministrators(update.message.chat.id, *args, **kwargs)

get_member(*args, **kwargs)

Shortcut for bot.getChatMember(update.message.chat.id, *args, **kwargs)

get_members_count(*args, **kwargs)

Shortcut for bot.getChatMembersCount(update.message.chat.id, *args, **kwargs)

kick_member(*args, **kwargs)

Shortcut for bot.kickChatMember(update.message.chat.id, *args, **kwargs)

leave(*args, **kwargs)

Shortcut for bot.leaveChat(update.message.chat.id, *args, **kwargs)

send_action(*args, **kwargs)

Shortcut for bot.sendChatAction(update.message.chat.id, *args, **kwargs)

unban_member(*args, **kwargs)

Shortcut for bot.unbanChatMember(update.message.chat.id, *args, **kwargs)