Media objects

Poll

class Poll(*, id_unique, question, options, is_closed)

This class contains information about a poll

Parameters
  • id_unique (str) – Unique poll identifier

  • question (str) – Poll question, 1-255 characters

  • options (list of PollOption) – List of poll options

  • is_closed (bool) – True, if the poll is closed

PollOption

class PollOption(*, text, voter_count)

This class contains information about one answer option in a poll

Parameters
  • text (str) – Option text, 1-100 characters

  • voter_count (int) – Number of users that voted for this option

Venue

class Venue(*, location, title, address, foursquare_id=None, foursquare_type=None)

This class represents a venue

Parameters
  • location (Location) – Venue location

  • title (str) – Name of the venue

  • address (str) – Address of the venue

  • foursquare_id (str) – Optional: Foursquare identifier of the venue

  • foursquare_type (str) – Optional: Foursquare type of the venue

Location

class Location(*, longitude, latitude)

This class represents a point on the map

Parameters
  • longitude (float) – Longitude as defined by the sender

  • latitude (float) – Latitude as defined by the sender

Contact

class Contact(*, phone_number, first_name, last_name=None, user_id=None, vcard=None)

This class represents a contact information

Parameters
  • phone_number (str) – Contact’s phone number

  • first_name (str) – Contact’s first name

  • last_name (str) – Optional: Contact’s last name

  • user_id (str) – Optional: Contact’s user identifier in Telegram

  • vcard (str) – Optional: Additional data about the contact in form of a vCard

VideoNote

class VideoNote(*, file_id, length, duration, thumb=None, file_size=None)

This class represents a video message

Parameters
  • file_id (str) – Identifier for this file

  • length (int) – Video width and height as defined by sender

  • duration (int) – Duration of the video in seconds as defined by sender

  • thumb (PhotoSize) – Optional: Video thumbnail

  • file_size (int) – Optional: Size of file

Voice

class Voice(*, file_id, duration, mime_type=None, file_size=None)

This class represents a voice note

Parameters
  • file_id (str) – Identifier for this file

  • duration (int) – Duration of the audio in seconds as defined by sender

  • mime_type (int) – MIME type of the file as defined by sender

  • file_size (str) – Size of file

Video

class Video(*, file_id, width, height, duration, thumb=None, mime_type=None, file_size=None)

This class represents a video file

Parameters
  • file_id (str) – Identifier for this file

  • width (int) – Video width as defined by sender

  • height (int) – Video height as defined by sender

  • duration (int) – Duration of the video in seconds defined by sender

  • thumb (PhotoSize) – Optional: Video thumbnail

  • mime_type (str) – Optional: MIME type of a file as defined by sender

  • file_size (int) – Optional: Size of file

Animation

class Animation(*, file_id, width, height, duration, thumb=None, file_name=None, mime_type=None, file_size=None)

This object represents an animation file (GIF or H.264/MPEG-4 AVC video without sound).

Parameters
  • file_id (str) – Identifier for this file

  • width (int) – Video width as defined by sender

  • height (int) – Video height as defined by sender

  • duration (int) – Duration of the video in seconds as defined by sender

  • thumb (PhotoSize) – Optional: Animation thumbnail as defined by sender

  • file_name (str) – Optional: Original animation filename as defined by sender

  • mime_type (str) – MIME type of the file as defined by sender

  • file_size (int) – Size of the file

Document

class Document(*, file_id, thumb=None, file_name=None, mime_type=None, file_size=None)

This class represents a general file

Parameters
  • file_id (str) – Identifier for this file

  • thumb (PhotoSize) – Optional: Document thumbnail as defined by sender

  • file_name (str) – Optional: Original filename as defined by sender

  • mime_type (str) – Optional: MIME type of the file as defined by sender

  • file_size (int) – Size of the file

Audio

class Audio(*, file_id, duration, performer=None, title=None, mime_type=None, file_size=None, thumb=None)

This objects represents an audio file to be treated as music by the Telegram client

Parameters
  • file_id (str) – Identifier for this file

  • duration (int) – Duration of the audio in seconds as defined by sender

  • performer (str) – Optional: Performer of the audio as defined by sender or by audio tags

  • title (str) – Optional: Title of the audio as defined by sender or by audio tags

  • mime_type (str) – Optional: MIME type of the file as defined by sender

  • file_size (int) – Optional: Size of the file

  • thumb (PhotoSize) – Optional: Thumbnail of the album cover to which the music belongs

PhotoSize

class PhotoSize(*, file_id, width, height, file_size=None)

This class represents one size of a photo or a file / sticker thumbnail

Parameters
  • file_id (int) – Identifier for the file

  • width (int) – Width of the photo

  • height (int) – Height of the photo

  • file_size (int) – Optional: Size of the file