telegram.Chat

class telegram.Chat(id, type, title=None, username=None, first_name=None, last_name=None, bot=None, photo=None, description=None, invite_link=None, pinned_message=None, permissions=None, sticker_set_name=None, can_set_sticker_set=None, slow_mode_delay=None, bio=None, linked_chat_id=None, location=None, **_kwargs)

Bases: telegram.base.TelegramObject

This object represents a chat.

Objects of this class are comparable in terms of equality. Two objects of this class are considered equal, if their id is equal.

Parameters
  • id (int) – Unique identifier for this chat. This number may be greater than 32 bits and some programming languages may have difficulty/silent defects in interpreting it. But it is smaller than 52 bits, so a signed 64 bit integer or double-precision float type are safe for storing this identifier.

  • type (str) – Type of chat, can be either ‘private’, ‘group’, ‘supergroup’ or ‘channel’.

  • title (str, optional) – Title, for supergroups, channels and group chats.

  • username (str, optional) – Username, for private chats, supergroups and channels if available.

  • first_name (str, optional) – First name of the other party in a private chat.

  • last_name (str, optional) – Last name of the other party in a private chat.

  • photo (telegram.ChatPhoto, optional) – Chat photo. Returned only in telegram.Bot.get_chat().

  • bio (str, optional) – Bio of the other party in a private chat. Returned only in telegram.Bot.get_chat().

  • description (str, optional) – Description, for groups, supergroups and channel chats. Returned only in telegram.Bot.get_chat().

  • invite_link (str, optional) – Chat invite link, for groups, supergroups and channel chats. Each administrator in a chat generates their own invite links, so the bot must first generate the link using export_chat_invite_link(). Returned only in telegram.Bot.get_chat().

  • pinned_message (telegram.Message, optional) – The most recent pinned message (by sending date). Returned only in telegram.Bot.get_chat().

  • permissions (telegram.ChatPermissions) – Optional. Default chat member permissions, for groups and supergroups. Returned only in telegram.Bot.get_chat().

  • slow_mode_delay (int, optional) – For supergroups, the minimum allowed delay between consecutive messages sent by each unprivileged user. Returned only in telegram.Bot.get_chat().

  • bot (telegram.Bot, optional) – The Bot to use for instance methods.

  • sticker_set_name (str, optional) – For supergroups, name of group sticker set. Returned only in telegram.Bot.get_chat().

  • can_set_sticker_set (bool, optional) – True, if the bot can change group the sticker set. Returned only in telegram.Bot.get_chat().

  • linked_chat_id (int, optional) – Unique identifier for the linked chat, i.e. the discussion group identifier for a channel and vice versa; for supergroups and channel chats. Returned only in telegram.Bot.get_chat().

  • location (telegram.ChatLocation, optional) – For supergroups, the location to which the supergroup is connected. Returned only in telegram.Bot.get_chat().

  • **kwargs (dict) – Arbitrary keyword arguments.

id

Unique identifier for this chat.

Type

int

type

Type of chat.

Type

str

title

Optional. Title, for supergroups, channels and group chats.

Type

str

username

Optional. Username.

Type

str

first_name

Optional. First name of the other party in a private chat.

Type

str

last_name

Optional. Last name of the other party in a private chat.

Type

str

photo

Optional. Chat photo.

Type

telegram.ChatPhoto

bio

Optional. Bio of the other party in a private chat. Returned only in telegram.Bot.get_chat().

Type

str

description

Optional. Description, for groups, supergroups and channel chats.

Type

str

Optional. Chat invite link, for supergroups and channel chats.

Type

str

pinned_message

Optional. The most recent pinned message (by sending date). Returned only in telegram.Bot.get_chat().

Type

telegram.Message

permissions

Optional. Default chat member permissions, for groups and supergroups. Returned only in telegram.Bot.get_chat().

Type

telegram.ChatPermissions

slow_mode_delay

Optional. For supergroups, the minimum allowed delay between consecutive messages sent by each unprivileged user. Returned only in telegram.Bot.get_chat().

Type

int

sticker_set_name

Optional. For supergroups, name of Group sticker set.

Type

str

can_set_sticker_set

Optional. True, if the bot can change group the sticker set.

Type

bool

linked_chat_id

Optional. Unique identifier for the linked chat, i.e. the discussion group identifier for a channel and vice versa; for supergroups and channel chats. Returned only in telegram.Bot.get_chat().

Type

int

location

Optional. For supergroups, the location to which the supergroup is connected. Returned only in telegram.Bot.get_chat().

Type

telegram.ChatLocation

CHANNEL: ClassVar[str] = 'channel'

telegram.constants.CHAT_CHANNEL

GROUP: ClassVar[str] = 'group'

telegram.constants.CHAT_GROUP

PRIVATE: ClassVar[str] = 'private'

telegram.constants.CHAT_PRIVATE

SUPERGROUP: ClassVar[str] = 'supergroup'

telegram.constants.CHAT_SUPERGROUP

copy_message(chat_id, message_id, caption=None, parse_mode=None, caption_entities=None, disable_notification=None, reply_to_message_id=None, allow_sending_without_reply=None, reply_markup=None, timeout=None, api_kwargs=None)

Shortcut for:

bot.copy_message(from_chat_id=update.effective_chat.id, *args, **kwargs)

For the documentation of the arguments, please see telegram.Bot.copy_message().

Returns

On success, instance representing the message posted.

Return type

telegram.Message

Parameters
  • chat_id (Union[int, str]) –

  • message_id (Union[str, int]) –

  • caption (str) –

  • parse_mode (Optional[Union[DefaultValue[DVType], str]]) –

  • caption_entities (Union[Tuple[MessageEntity, ..], List[MessageEntity]]) –

  • disable_notification (Union[DefaultValue[DVType], bool]) –

  • reply_to_message_id (Union[int, str]) –

  • allow_sending_without_reply (Union[DefaultValue[DVType], bool]) –

  • reply_markup (ReplyMarkup) –

  • timeout (Optional[Union[DefaultValue[DVType], float]]) –

  • api_kwargs (Dict[str, Any]) –

property full_name

Convenience property. If first_name is not None gives, first_name followed by (if available) last_name.

Note

full_name will always be None, if the chat is a (super)group or channel.

New in version 13.2.

Type

str

get_administrators(timeout=None, api_kwargs=None)

Shortcut for:

bot.get_chat_administrators(update.effective_chat.id, *args, **kwargs)

For the documentation of the arguments, please see telegram.Bot.get_chat_administrators().

Returns

A list of administrators in a chat. An Array of telegram.ChatMember objects that contains information about all chat administrators except other bots. If the chat is a group or a supergroup and no administrators were appointed, only the creator will be returned.

Return type

List[telegram.ChatMember]

Parameters
  • timeout (Optional[Union[DefaultValue[DVType], float]]) –

  • api_kwargs (Dict[str, Any]) –

get_member(user_id, timeout=None, api_kwargs=None)

Shortcut for:

bot.get_chat_member(update.effective_chat.id, *args, **kwargs)

For the documentation of the arguments, please see telegram.Bot.get_chat_member().

Returns

telegram.ChatMember

Parameters
  • user_id (Union[str, int]) –

  • timeout (Optional[Union[DefaultValue[DVType], float]]) –

  • api_kwargs (Dict[str, Any]) –

Return type

ChatMember

get_members_count(timeout=None, api_kwargs=None)

Shortcut for:

bot.get_chat_members_count(update.effective_chat.id, *args, **kwargs)

For the documentation of the arguments, please see telegram.Bot.get_chat_members_count().

Returns

int

Parameters
  • timeout (Optional[Union[DefaultValue[DVType], float]]) –

  • api_kwargs (Dict[str, Any]) –

Return type

int

kick_member(user_id, timeout=None, until_date=None, api_kwargs=None)

Shortcut for:

bot.kick_chat_member(update.effective_chat.id, *args, **kwargs)

For the documentation of the arguments, please see telegram.Bot.kick_chat_member().

Returns

If the action was sent successfully.

Return type

bool

Parameters
  • user_id (Union[str, int]) –

  • timeout (Optional[Union[DefaultValue[DVType], float]]) –

  • until_date (Union[int, datetime.datetime]) –

  • api_kwargs (Dict[str, Any]) –

Note

This method will only work if the All Members Are Admins setting is off in the target group. Otherwise members may only be removed by the group’s creator or by the member that added them.

leave(timeout=None, api_kwargs=None)

Shortcut for:

bot.leave_chat(update.effective_chat.id, *args, **kwargs)

For the documentation of the arguments, please see telegram.Bot.leave_chat().

Returns

bool If the action was sent successfully.

Parameters
  • timeout (Optional[Union[DefaultValue[DVType], float]]) –

  • api_kwargs (Dict[str, Any]) –

Return type

bool

Convenience property. If the chat has a username, returns a t.me link of the chat.

Type

str

pin_message(message_id, disable_notification=None, timeout=None, api_kwargs=None)

Shortcut for:

bot.pin_chat_message(chat_id=update.effective_chat.id,
                     *args,
                     **kwargs)

For the documentation of the arguments, please see telegram.Bot.pin_chat_message().

Returns

On success, True is returned.

Return type

bool

Parameters
  • message_id (Union[str, int]) –

  • disable_notification (Optional[Union[DefaultValue[DVType], bool]]) –

  • timeout (Optional[Union[DefaultValue[DVType], float]]) –

  • api_kwargs (Dict[str, Any]) –

promote_member(user_id, can_change_info=None, can_post_messages=None, can_edit_messages=None, can_delete_messages=None, can_invite_users=None, can_restrict_members=None, can_pin_messages=None, can_promote_members=None, timeout=None, api_kwargs=None, is_anonymous=None)

Shortcut for:

bot.promote_chat_member(update.effective_chat.id, *args, **kwargs)

For the documentation of the arguments, please see telegram.Bot.promote_chat_member().

New in version 13.2.

Returns

If the action was sent successfully.

Return type

bool

Parameters
  • user_id (Union[str, int]) –

  • can_change_info (bool) –

  • can_post_messages (bool) –

  • can_edit_messages (bool) –

  • can_delete_messages (bool) –

  • can_invite_users (bool) –

  • can_restrict_members (bool) –

  • can_pin_messages (bool) –

  • can_promote_members (bool) –

  • timeout (Optional[Union[DefaultValue[DVType], float]]) –

  • api_kwargs (Dict[str, Any]) –

  • is_anonymous (bool) –

restrict_member(user_id, permissions, until_date=None, timeout=None, api_kwargs=None)

Shortcut for:

bot.restrict_chat_member(update.effective_chat.id, *args, **kwargs)

For the documentation of the arguments, please see telegram.Bot.restrict_chat_member().

New in version 13.2.

Returns

If the action was sent successfully.

Return type

bool

Parameters
  • user_id (Union[str, int]) –

  • permissions (telegram.chatpermissions.ChatPermissions) –

  • until_date (Union[int, datetime.datetime]) –

  • timeout (Optional[Union[DefaultValue[DVType], float]]) –

  • api_kwargs (Dict[str, Any]) –

send_action(action, timeout=None, api_kwargs=None)

Alias for send_chat_action

Parameters
  • action (str) –

  • timeout (Optional[Union[DefaultValue[DVType], float]]) –

  • api_kwargs (Dict[str, Any]) –

Return type

bool

send_animation(animation, duration=None, width=None, height=None, thumb=None, caption=None, parse_mode=None, disable_notification=None, reply_to_message_id=None, reply_markup=None, timeout=20, api_kwargs=None, allow_sending_without_reply=None, caption_entities=None, filename=None)

Shortcut for:

bot.send_animation(update.effective_chat.id, *args, **kwargs)

For the documentation of the arguments, please see telegram.Bot.send_animation().

Returns

On success, instance representing the message posted.

Return type

telegram.Message

Parameters
  • animation (Union[str, bytes, IO, InputFile, pathlib.Path, Animation]) –

  • duration (int) –

  • width (int) –

  • height (int) –

  • thumb (Union[str, bytes, IO, InputFile, pathlib.Path]) –

  • caption (str) –

  • parse_mode (Optional[Union[DefaultValue[DVType], str]]) –

  • disable_notification (Union[DefaultValue[DVType], bool]) –

  • reply_to_message_id (Union[int, str]) –

  • reply_markup (ReplyMarkup) –

  • timeout (Union[DefaultValue[DVType], float]) –

  • api_kwargs (Dict[str, Any]) –

  • allow_sending_without_reply (Optional[Union[DefaultValue[DVType], bool]]) –

  • caption_entities (Union[List[MessageEntity], Tuple[MessageEntity, ..]]) –

  • filename (str) –

send_audio(audio, duration=None, performer=None, title=None, caption=None, disable_notification=None, reply_to_message_id=None, reply_markup=None, timeout=20, parse_mode=None, thumb=None, api_kwargs=None, allow_sending_without_reply=None, caption_entities=None, filename=None)

Shortcut for:

bot.send_audio(update.effective_chat.id, *args, **kwargs)

For the documentation of the arguments, please see telegram.Bot.send_audio().

Returns

On success, instance representing the message posted.

Return type

telegram.Message

Parameters
  • audio (Union[str, bytes, IO, InputFile, pathlib.Path, Audio]) –

  • duration (int) –

  • performer (str) –

  • title (str) –

  • caption (str) –

  • disable_notification (Union[DefaultValue[DVType], bool]) –

  • reply_to_message_id (Union[int, str]) –

  • reply_markup (ReplyMarkup) –

  • timeout (Union[DefaultValue[DVType], float]) –

  • parse_mode (Optional[Union[DefaultValue[DVType], str]]) –

  • thumb (Union[str, bytes, IO, InputFile, pathlib.Path]) –

  • api_kwargs (Dict[str, Any]) –

  • allow_sending_without_reply (Optional[Union[DefaultValue[DVType], bool]]) –

  • caption_entities (Union[List[MessageEntity], Tuple[MessageEntity, ..]]) –

  • filename (str) –

send_chat_action(action, timeout=None, api_kwargs=None)

Shortcut for:

bot.send_chat_action(update.effective_chat.id, *args, **kwargs)

For the documentation of the arguments, please see telegram.Bot.send_chat_action().

Returns

On success, True is returned.

Return type

bool

Parameters
  • action (str) –

  • timeout (Optional[Union[DefaultValue[DVType], float]]) –

  • api_kwargs (Dict[str, Any]) –

send_contact(phone_number=None, first_name=None, last_name=None, disable_notification=None, reply_to_message_id=None, reply_markup=None, timeout=None, contact=None, vcard=None, api_kwargs=None, allow_sending_without_reply=None)

Shortcut for:

bot.send_contact(update.effective_chat.id, *args, **kwargs)

For the documentation of the arguments, please see telegram.Bot.send_contact().

Returns

On success, instance representing the message posted.

Return type

telegram.Message

Parameters
  • phone_number (str) –

  • first_name (str) –

  • last_name (str) –

  • disable_notification (Union[DefaultValue[DVType], bool]) –

  • reply_to_message_id (Union[int, str]) –

  • reply_markup (ReplyMarkup) –

  • timeout (Optional[Union[DefaultValue[DVType], float]]) –

  • contact (Contact) –

  • vcard (str) –

  • api_kwargs (Dict[str, Any]) –

  • allow_sending_without_reply (Optional[Union[DefaultValue[DVType], bool]]) –

send_copy(from_chat_id, message_id, caption=None, parse_mode=None, caption_entities=None, disable_notification=None, reply_to_message_id=None, allow_sending_without_reply=None, reply_markup=None, timeout=None, api_kwargs=None)

Shortcut for:

bot.copy_message(chat_id=update.effective_chat.id, *args, **kwargs)

For the documentation of the arguments, please see telegram.Bot.copy_message().

Returns

On success, instance representing the message posted.

Return type

telegram.Message

Parameters
  • from_chat_id (Union[str, int]) –

  • message_id (Union[str, int]) –

  • caption (str) –

  • parse_mode (Optional[Union[DefaultValue[DVType], str]]) –

  • caption_entities (Union[Tuple[MessageEntity, ..], List[MessageEntity]]) –

  • disable_notification (Union[DefaultValue[DVType], bool]) –

  • reply_to_message_id (Union[int, str]) –

  • allow_sending_without_reply (Union[DefaultValue[DVType], bool]) –

  • reply_markup (ReplyMarkup) –

  • timeout (Optional[Union[DefaultValue[DVType], float]]) –

  • api_kwargs (Dict[str, Any]) –

send_dice(disable_notification=None, reply_to_message_id=None, reply_markup=None, timeout=None, emoji=None, api_kwargs=None, allow_sending_without_reply=None)

Shortcut for:

bot.send_dice(update.effective_chat.id, *args, **kwargs)

For the documentation of the arguments, please see telegram.Bot.send_dice().

Returns

On success, instance representing the message posted.

Return type

telegram.Message

Parameters
  • disable_notification (Optional[Union[DefaultValue[DVType], bool]]) –

  • reply_to_message_id (Union[int, str]) –

  • reply_markup (ReplyMarkup) –

  • timeout (Optional[Union[DefaultValue[DVType], float]]) –

  • emoji (str) –

  • api_kwargs (Dict[str, Any]) –

  • allow_sending_without_reply (Optional[Union[DefaultValue[DVType], bool]]) –

send_document(document, filename=None, caption=None, disable_notification=None, reply_to_message_id=None, reply_markup=None, timeout=20, parse_mode=None, thumb=None, api_kwargs=None, disable_content_type_detection=None, allow_sending_without_reply=None, caption_entities=None)

Shortcut for:

bot.send_document(update.effective_chat.id, *args, **kwargs)

For the documentation of the arguments, please see telegram.Bot.send_document().

Returns

On success, instance representing the message posted.

Return type

telegram.Message

Parameters
  • document (Union[str, bytes, IO, InputFile, pathlib.Path, Document]) –

  • filename (str) –

  • caption (str) –

  • disable_notification (Union[DefaultValue[DVType], bool]) –

  • reply_to_message_id (Union[int, str]) –

  • reply_markup (ReplyMarkup) –

  • timeout (Union[DefaultValue[DVType], float]) –

  • parse_mode (Optional[Union[DefaultValue[DVType], str]]) –

  • thumb (Union[str, bytes, IO, InputFile, pathlib.Path]) –

  • api_kwargs (Dict[str, Any]) –

  • disable_content_type_detection (bool) –

  • allow_sending_without_reply (Optional[Union[DefaultValue[DVType], bool]]) –

  • caption_entities (Union[List[MessageEntity], Tuple[MessageEntity, ..]]) –

send_game(game_short_name, disable_notification=None, reply_to_message_id=None, reply_markup=None, timeout=None, api_kwargs=None, allow_sending_without_reply=None)

Shortcut for:

bot.send_game(update.effective_chat.id, *args, **kwargs)

For the documentation of the arguments, please see telegram.Bot.send_game().

Returns

On success, instance representing the message posted.

Return type

telegram.Message

Parameters
  • game_short_name (str) –

  • disable_notification (Union[DefaultValue[DVType], bool]) –

  • reply_to_message_id (Union[int, str]) –

  • reply_markup (InlineKeyboardMarkup) –

  • timeout (Optional[Union[DefaultValue[DVType], float]]) –

  • api_kwargs (Dict[str, Any]) –

  • allow_sending_without_reply (Optional[Union[DefaultValue[DVType], bool]]) –

send_invoice(title, description, payload, provider_token, start_parameter, currency, prices, photo_url=None, photo_size=None, photo_width=None, photo_height=None, need_name=None, need_phone_number=None, need_email=None, need_shipping_address=None, is_flexible=None, disable_notification=None, reply_to_message_id=None, reply_markup=None, provider_data=None, send_phone_number_to_provider=None, send_email_to_provider=None, timeout=None, api_kwargs=None, allow_sending_without_reply=None)

Shortcut for:

bot.send_invoice(update.effective_chat.id, *args, **kwargs)

For the documentation of the arguments, please see telegram.Bot.send_invoice().

Returns

On success, instance representing the message posted.

Return type

telegram.Message

Parameters
  • title (str) –

  • description (str) –

  • payload (str) –

  • provider_token (str) –

  • start_parameter (str) –

  • currency (str) –

  • prices (List[LabeledPrice]) –

  • photo_url (str) –

  • photo_size (int) –

  • photo_width (int) –

  • photo_height (int) –

  • need_name (bool) –

  • need_phone_number (bool) –

  • need_email (bool) –

  • need_shipping_address (bool) –

  • is_flexible (bool) –

  • disable_notification (Union[DefaultValue[DVType], bool]) –

  • reply_to_message_id (Union[int, str]) –

  • reply_markup (InlineKeyboardMarkup) –

  • provider_data (Union[str, object]) –

  • send_phone_number_to_provider (bool) –

  • send_email_to_provider (bool) –

  • timeout (Optional[Union[DefaultValue[DVType], float]]) –

  • api_kwargs (Dict[str, Any]) –

  • allow_sending_without_reply (Optional[Union[DefaultValue[DVType], bool]]) –

send_location(latitude=None, longitude=None, disable_notification=None, reply_to_message_id=None, reply_markup=None, timeout=None, location=None, live_period=None, api_kwargs=None, horizontal_accuracy=None, heading=None, proximity_alert_radius=None, allow_sending_without_reply=None)

Shortcut for:

bot.send_location(update.effective_chat.id, *args, **kwargs)

For the documentation of the arguments, please see telegram.Bot.send_location().

Returns

On success, instance representing the message posted.

Return type

telegram.Message

Parameters
  • latitude (float) –

  • longitude (float) –

  • disable_notification (Union[DefaultValue[DVType], bool]) –

  • reply_to_message_id (Union[int, str]) –

  • reply_markup (ReplyMarkup) –

  • timeout (Optional[Union[DefaultValue[DVType], float]]) –

  • location (Location) –

  • live_period (int) –

  • api_kwargs (Dict[str, Any]) –

  • horizontal_accuracy (float) –

  • heading (int) –

  • proximity_alert_radius (int) –

  • allow_sending_without_reply (Optional[Union[DefaultValue[DVType], bool]]) –

send_media_group(media, disable_notification=None, reply_to_message_id=None, timeout=20, api_kwargs=None, allow_sending_without_reply=None)

Shortcut for:

bot.send_media_group(update.effective_chat.id, *args, **kwargs)

For the documentation of the arguments, please see telegram.Bot.send_media_group().

Returns

] On success, instance representing the message posted.

Return type

List[telegram.Message

Parameters
send_message(text, parse_mode=None, disable_web_page_preview=None, disable_notification=None, reply_to_message_id=None, reply_markup=None, timeout=None, api_kwargs=None, allow_sending_without_reply=None, entities=None)

Shortcut for:

bot.send_message(update.effective_chat.id, *args, **kwargs)

For the documentation of the arguments, please see telegram.Bot.send_message().

Returns

On success, instance representing the message posted.

Return type

telegram.Message

Parameters
  • text (str) –

  • parse_mode (Optional[Union[DefaultValue[DVType], str]]) –

  • disable_web_page_preview (Optional[Union[DefaultValue[DVType], bool]]) –

  • disable_notification (Union[DefaultValue[DVType], bool]) –

  • reply_to_message_id (Union[int, str]) –

  • reply_markup (ReplyMarkup) –

  • timeout (Optional[Union[DefaultValue[DVType], float]]) –

  • api_kwargs (Dict[str, Any]) –

  • allow_sending_without_reply (Optional[Union[DefaultValue[DVType], bool]]) –

  • entities (Union[List[MessageEntity], Tuple[MessageEntity, ..]]) –

send_photo(photo, caption=None, disable_notification=None, reply_to_message_id=None, reply_markup=None, timeout=20, parse_mode=None, api_kwargs=None, allow_sending_without_reply=None, caption_entities=None, filename=None)

Shortcut for:

bot.send_photo(update.effective_chat.id, *args, **kwargs)

For the documentation of the arguments, please see telegram.Bot.send_photo().

Returns

On success, instance representing the message posted.

Return type

telegram.Message

Parameters
  • photo (Union[str, bytes, IO, InputFile, pathlib.Path, PhotoSize]) –

  • caption (str) –

  • disable_notification (Union[DefaultValue[DVType], bool]) –

  • reply_to_message_id (Union[int, str]) –

  • reply_markup (ReplyMarkup) –

  • timeout (Union[DefaultValue[DVType], float]) –

  • parse_mode (Optional[Union[DefaultValue[DVType], str]]) –

  • api_kwargs (Dict[str, Any]) –

  • allow_sending_without_reply (Optional[Union[DefaultValue[DVType], bool]]) –

  • caption_entities (Union[List[MessageEntity], Tuple[MessageEntity, ..]]) –

  • filename (str) –

send_poll(question, options, is_anonymous=True, type='regular', allows_multiple_answers=False, correct_option_id=None, is_closed=None, disable_notification=None, reply_to_message_id=None, reply_markup=None, timeout=None, explanation=None, explanation_parse_mode=None, open_period=None, close_date=None, api_kwargs=None, allow_sending_without_reply=None, explanation_entities=None)

Shortcut for:

bot.send_poll(update.effective_chat.id, *args, **kwargs)

For the documentation of the arguments, please see telegram.Bot.send_poll().

Returns

On success, instance representing the message posted.

Return type

telegram.Message

Parameters
  • question (str) –

  • options (List[str]) –

  • is_anonymous (bool) –

  • type (str) –

  • allows_multiple_answers (bool) –

  • correct_option_id (int) –

  • is_closed (bool) –

  • disable_notification (Optional[Union[DefaultValue[DVType], bool]]) –

  • reply_to_message_id (Union[int, str]) –

  • reply_markup (ReplyMarkup) –

  • timeout (Optional[Union[DefaultValue[DVType], float]]) –

  • explanation (str) –

  • explanation_parse_mode (Optional[Union[DefaultValue[DVType], str]]) –

  • open_period (int) –

  • close_date (Union[int, datetime.datetime]) –

  • api_kwargs (Dict[str, Any]) –

  • allow_sending_without_reply (Optional[Union[DefaultValue[DVType], bool]]) –

  • explanation_entities (Union[List[MessageEntity], Tuple[MessageEntity, ..]]) –

send_sticker(sticker, disable_notification=None, reply_to_message_id=None, reply_markup=None, timeout=20, api_kwargs=None, allow_sending_without_reply=None)

Shortcut for:

bot.send_sticker(update.effective_chat.id, *args, **kwargs)

For the documentation of the arguments, please see telegram.Bot.send_sticker().

Returns

On success, instance representing the message posted.

Return type

telegram.Message

Parameters
  • sticker (Union[str, bytes, IO, InputFile, pathlib.Path, Sticker]) –

  • disable_notification (Union[DefaultValue[DVType], bool]) –

  • reply_to_message_id (Union[int, str]) –

  • reply_markup (ReplyMarkup) –

  • timeout (Union[DefaultValue[DVType], float]) –

  • api_kwargs (Dict[str, Any]) –

  • allow_sending_without_reply (Optional[Union[DefaultValue[DVType], bool]]) –

send_venue(latitude=None, longitude=None, title=None, address=None, foursquare_id=None, disable_notification=None, reply_to_message_id=None, reply_markup=None, timeout=None, venue=None, foursquare_type=None, api_kwargs=None, google_place_id=None, google_place_type=None, allow_sending_without_reply=None)

Shortcut for:

bot.send_venue(update.effective_chat.id, *args, **kwargs)

For the documentation of the arguments, please see telegram.Bot.send_venue().

Returns

On success, instance representing the message posted.

Return type

telegram.Message

Parameters
  • latitude (float) –

  • longitude (float) –

  • title (str) –

  • address (str) –

  • foursquare_id (str) –

  • disable_notification (Union[DefaultValue[DVType], bool]) –

  • reply_to_message_id (Union[int, str]) –

  • reply_markup (ReplyMarkup) –

  • timeout (Optional[Union[DefaultValue[DVType], float]]) –

  • venue (Venue) –

  • foursquare_type (str) –

  • api_kwargs (Dict[str, Any]) –

  • google_place_id (str) –

  • google_place_type (str) –

  • allow_sending_without_reply (Optional[Union[DefaultValue[DVType], bool]]) –

send_video(video, duration=None, caption=None, disable_notification=None, reply_to_message_id=None, reply_markup=None, timeout=20, width=None, height=None, parse_mode=None, supports_streaming=None, thumb=None, api_kwargs=None, allow_sending_without_reply=None, caption_entities=None, filename=None)

Shortcut for:

bot.send_video(update.effective_chat.id, *args, **kwargs)

For the documentation of the arguments, please see telegram.Bot.send_video().

Returns

On success, instance representing the message posted.

Return type

telegram.Message

Parameters
  • video (Union[str, bytes, IO, InputFile, pathlib.Path, Video]) –

  • duration (int) –

  • caption (str) –

  • disable_notification (Union[DefaultValue[DVType], bool]) –

  • reply_to_message_id (Union[int, str]) –

  • reply_markup (ReplyMarkup) –

  • timeout (Union[DefaultValue[DVType], float]) –

  • width (int) –

  • height (int) –

  • parse_mode (Optional[Union[DefaultValue[DVType], str]]) –

  • supports_streaming (bool) –

  • thumb (Union[str, bytes, IO, InputFile, pathlib.Path]) –

  • api_kwargs (Dict[str, Any]) –

  • allow_sending_without_reply (Optional[Union[DefaultValue[DVType], bool]]) –

  • caption_entities (Union[List[MessageEntity], Tuple[MessageEntity, ..]]) –

  • filename (str) –

send_video_note(video_note, duration=None, length=None, disable_notification=None, reply_to_message_id=None, reply_markup=None, timeout=20, thumb=None, api_kwargs=None, allow_sending_without_reply=None, filename=None)

Shortcut for:

bot.send_video_note(update.effective_chat.id, *args, **kwargs)

For the documentation of the arguments, please see telegram.Bot.send_video_note().

Returns

On success, instance representing the message posted.

Return type

telegram.Message

Parameters
  • video_note (Union[str, bytes, IO, InputFile, pathlib.Path, VideoNote]) –

  • duration (int) –

  • length (int) –

  • disable_notification (Union[DefaultValue[DVType], bool]) –

  • reply_to_message_id (Union[int, str]) –

  • reply_markup (ReplyMarkup) –

  • timeout (Union[DefaultValue[DVType], float]) –

  • thumb (Union[str, bytes, IO, InputFile, pathlib.Path]) –

  • api_kwargs (Dict[str, Any]) –

  • allow_sending_without_reply (Optional[Union[DefaultValue[DVType], bool]]) –

  • filename (str) –

send_voice(voice, duration=None, caption=None, disable_notification=None, reply_to_message_id=None, reply_markup=None, timeout=20, parse_mode=None, api_kwargs=None, allow_sending_without_reply=None, caption_entities=None, filename=None)

Shortcut for:

bot.send_voice(update.effective_chat.id, *args, **kwargs)

For the documentation of the arguments, please see telegram.Bot.send_voice().

Returns

On success, instance representing the message posted.

Return type

telegram.Message

Parameters
  • voice (Union[str, bytes, IO, InputFile, pathlib.Path, Voice]) –

  • duration (int) –

  • caption (str) –

  • disable_notification (Union[DefaultValue[DVType], bool]) –

  • reply_to_message_id (Union[int, str]) –

  • reply_markup (ReplyMarkup) –

  • timeout (Union[DefaultValue[DVType], float]) –

  • parse_mode (Optional[Union[DefaultValue[DVType], str]]) –

  • api_kwargs (Dict[str, Any]) –

  • allow_sending_without_reply (Optional[Union[DefaultValue[DVType], bool]]) –

  • caption_entities (Union[List[MessageEntity], Tuple[MessageEntity, ..]]) –

  • filename (str) –

set_administrator_custom_title(user_id, custom_title, timeout=None, api_kwargs=None)

Shortcut for:

bot.set_chat_administrator_custom_title(update.effective_chat.id, *args, **kwargs)

For the documentation of the arguments, please see telegram.Bot.set_chat_administrator_custom_title().

Returns: bool: If the action was sent successfully.

Parameters
  • user_id (Union[int, str]) –

  • custom_title (str) –

  • timeout (Optional[Union[DefaultValue[DVType], float]]) –

  • api_kwargs (Dict[str, Any]) –

Return type

bool

set_permissions(permissions, timeout=None, api_kwargs=None)

Shortcut for:

bot.set_chat_permissions(update.effective_chat.id, *args, **kwargs)

For the documentation of the arguments, please see telegram.Bot.set_chat_permissions().

Returns

If the action was sent successfully.

Return type

bool

Parameters
  • permissions (telegram.chatpermissions.ChatPermissions) –

  • timeout (Optional[Union[DefaultValue[DVType], float]]) –

  • api_kwargs (Dict[str, Any]) –

unban_member(user_id, timeout=None, api_kwargs=None, only_if_banned=None)

Shortcut for:

bot.unban_chat_member(update.effective_chat.id, *args, **kwargs)

For the documentation of the arguments, please see telegram.Bot.unban_chat_member().

Returns

If the action was sent successfully.

Return type

bool

Parameters
  • user_id (Union[str, int]) –

  • timeout (Optional[Union[DefaultValue[DVType], float]]) –

  • api_kwargs (Dict[str, Any]) –

  • only_if_banned (bool) –

unpin_all_messages(timeout=None, api_kwargs=None)

Shortcut for:

bot.unpin_all_chat_messages(chat_id=update.effective_chat.id,
                            *args,
                            **kwargs)

For the documentation of the arguments, please see telegram.Bot.unpin_all_chat_messages().

Returns

On success, True is returned.

Return type

bool

Parameters
  • timeout (Optional[Union[DefaultValue[DVType], float]]) –

  • api_kwargs (Dict[str, Any]) –

unpin_message(timeout=None, api_kwargs=None, message_id=None)

Shortcut for:

bot.unpin_chat_message(chat_id=update.effective_chat.id,
                       *args,
                       **kwargs)

For the documentation of the arguments, please see telegram.Bot.unpin_chat_message().

Returns

On success, True is returned.

Return type

bool

Parameters
  • timeout (Optional[Union[DefaultValue[DVType], float]]) –

  • api_kwargs (Dict[str, Any]) –

  • message_id (Union[str, int]) –