pyrobale.objects.chatfullinfo

Classes

ChatFullInfo

Represents full info of a chat, usually returns in get_chat

Module Contents

class pyrobale.objects.chatfullinfo.ChatFullInfo(id, type, title=None, username=None, first_name=None, last_name=None, photo=None, bio=None, description=None, invite_link=None, linked_chat_id=None, accent_color_id=None, max_reaction_count=None, client=None, *args, **kwargs)[source]

Represents full info of a chat, usually returns in get_chat

Parameters:
  • id (int) – Unique id of the chat.

  • type (String or enums.ChatType) – The type of the chat that can be private, group or channel.

  • title (Optional[Str]) – The title of chat in groups and channels.

  • username (Optional[Str]) – The username of chat (if exists).

  • first_name (Optional[Str]) – The first name of user in a private chat.

  • last_name (Optional[Str]) – The last name of user in a private chat.

  • photo (Optional[ChatPhoto]) – The photo of chat or the profile of the user. (if exists)

  • bio (Optional[Str]) – The biography of user. (if exists)

  • description (Optional[Str]) – The description of chat. (if exists)

  • invite_link (Optional[Str]) – The invite link of chat or channel. (if the bot has permission to make one)

  • linked_chat_id (Optional[Str]) – The chat id of the linked comment group to a channel. (if exists)

  • **kwargs – Additional keyword arguments

  • accent_color_id (Optional[Any])

  • max_reaction_count (Optional[Any])

  • client (Optional[pyrobale.client.Client])

id[source]

Unique id of the chat.

Type:

int

type

The type of the chat that can be private, group or channel.

Type:

ChatType

title[source]

The title of chat in groups and channels.

Type:

Str

username[source]

The username of chat (if exists).

Type:

Str

first_name[source]

The first name of user in a private chat.

Type:

Str

last_name[source]

The last name of user in a private chat.

Type:

Str

full_name[source]

The property that returns the first_name and last_name together

Type:

Str

photo[source]

The photo of chat or the profile of the user. (if exists)

Type:

ChatPhoto

bio[source]

The biography of user. (if exists)

Type:

Str

description[source]

The description of chat. (if exists)

Type:

Str

The invite link of chat or channel. (if the bot has permission to make one)

Type:

Str

linked_chat_id[source]

The chat id of the linked comment group to a channel. (if exists)

Type:

Str

client[source]

Client instance

Type:

Client

id[source]
title = None[source]
username = None[source]
first_name = None[source]
last_name = None[source]
photo: pyrobale.objects.chatphoto.ChatPhoto = None[source]
bio = None[source]
description = None[source]
invite_link = None[source]
linked_chat_id = None[source]
client: pyrobale.client.Client = None[source]
accent_color_id = None[source]
max_reaction_count = None[source]
property full_name[source]
property is_private[source]
property is_group[source]
property is_channel[source]
property has_linked_group[source]
async send_message(text, reply_to_message_id=None, reply_markup=None)[source]

Send a message to the chat.

Parameters:
  • text (str) – Text of the message to be sent

  • reply_to_message_id (int, optional) – If the message is a reply, ID of the original message

  • reply_markup (Union[ReplyKeyboardMarkup, InlineKeyboardMarkup], optional) – Additional interface options

Returns:

The sent message object

Return type:

Message

async get_chat_member(user_id)[source]

Get information about a member of a chat.

Parameters:

user_id (int) – Unique identifier of the target user

Returns:

Information about the chat member

Return type:

ChatMember

async get_administrators()[source]

Gets a list of administrators of a specified chat.

Returns:

A list of administrators.

async get_chat_members_count()[source]

Get the number of members in the chat.

Returns:

Number of members in the chat

Return type:

int

async send_photo(photo, caption=None, reply_to_message_id=None, reply_markup=None)[source]

Send a photo to the chat.

Parameters:
  • photo (str) – Photo to send (file_id or URL)

  • caption (Optional[str]) – Photo caption

  • reply_to_message_id (int, optional) – If the message is a reply, ID of the original message

  • reply_markup (Union[ReplyKeyboardMarkup, InlineKeyboardMarkup], optional) – Additional interface options

Returns:

The sent message object

Return type:

Message

async send_video(video, caption=None, reply_to_message_id=None, reply_markup=None)[source]

Send a video to the chat.

Parameters:
  • video (str) – Video to send (file_id or URL)

  • caption (Optional[str]) – Video caption

  • reply_to_message_id (int, optional) – If the message is a reply, ID of the original message

  • reply_markup (Union[ReplyKeyboardMarkup, InlineKeyboardMarkup], optional) – Additional interface options

Returns:

The sent message object

Return type:

Message

async send_audio(audio, caption=None, reply_to_message_id=None, reply_markup=None)[source]

Send an audio file to the chat.

Parameters:
  • audio (str) – Audio file to send (file_id or URL)

  • caption (Optional[str]) – Audio caption

  • reply_to_message_id (int, optional) – If the message is a reply, ID of the original message

  • reply_markup (Union[ReplyKeyboardMarkup, InlineKeyboardMarkup], optional) – Additional interface options

Returns:

The sent message object

Return type:

Message

async send_document(document, caption=None, reply_to_message_id=None, reply_markup=None)[source]

Send a document to the chat.

Parameters:
  • document (str) – Document to send (file_id or URL)

  • caption (Optional[str]) – Document caption

  • reply_to_message_id (int, optional) – If the message is a reply, ID of the original message

  • reply_markup (Union[ReplyKeyboardMarkup, InlineKeyboardMarkup], optional) – Additional interface options

Returns:

The sent message object

Return type:

Message

async send_sticker(sticker, reply_to_message_id=None, reply_markup=None)[source]

Send a sticker to the chat.

Parameters:
  • sticker (str) – Sticker to send (file_id or URL)

  • reply_to_message_id (int, optional) – If the message is a reply, ID of the original message

  • reply_markup (Union[ReplyKeyboardMarkup, InlineKeyboardMarkup], optional) – Additional interface options

Returns:

The sent message object

Return type:

Message

async send_voice(voice, caption=None, reply_to_message_id=None, reply_markup=None)[source]

Send a voice message to the chat.

Parameters:
  • voice (str) – Voice message to send (file_id or URL)

  • caption (Optional[str]) – Voice message caption

  • reply_to_message_id (int, optional) – If the message is a reply, ID of the original message

  • reply_markup (Union[ReplyKeyboardMarkup, InlineKeyboardMarkup], optional) – Additional interface options

Returns:

The sent message object

Return type:

Message

async send_location(latitude, longitude, reply_to_message_id=None, reply_markup=None)[source]

Send a location to the chat.

Parameters:
  • latitude (float) – Latitude of the location

  • longitude (float) – Longitude of the location

  • reply_to_message_id (int, optional) – If the message is a reply, ID of the original message

  • reply_markup (Union[ReplyKeyboardMarkup, InlineKeyboardMarkup], optional) – Additional interface options

Returns:

The sent message object

Return type:

Message

async send_contact(phone_number, first_name, last_name=None, reply_to_message_id=None, reply_markup=None)[source]

Send a contact to the chat.

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

  • first_name (str) – Contact’s first name

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

  • reply_to_message_id (int, optional) – If the message is a reply, ID of the original message

  • reply_markup (Union[ReplyKeyboardMarkup, InlineKeyboardMarkup], optional) – Additional interface options

Returns:

The sent message object

Return type:

Message

async ban(user_id)[source]

Bans a user from the chat.

Parameters:
  • user_id (int) – Unique identifier of the target user

  • until_date (Optional[int]) – Date when the user will be unbanned (Unix time)

Returns:

True on success

Return type:

bool

async kick(user_id)[source]

Kicks a user from the chat.

Parameters:

user_id (int) – Unique identifier of the target user

Returns:

True on success

Return type:

bool

async unban(user_id)[source]

Unban a previously banned user in the chat.

Parameters:

user_id (int) – Unique identifier of the target user

Returns:

True on success

Return type:

bool

async restrict(user_id, can_send_messages=None, can_send_media_messages=None, can_send_other_messages=None, can_add_web_page_previews=None, until_date=None)[source]

Restricts a user from a chat.

Parameters:
  • user_id (int) – The user to ban.

  • can_send_messages (Union[bool,None]) – Default is None

  • can_send_media_messages (Union[bool,None]) – Default is None

  • can_send_other_messages (Union[bool,None]) – Default is None

  • can_add_web_page_previews (Union[bool,None]) – Default is None

  • until_date (Union[int, None]) – (Union[int,None]) Default is None

Returns:

Whether the ban was successful.

Return type:

bool

async promote(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)[source]

Promote or demote a user in a chat.

Parameters:
  • user_id (int) – Unique identifier of the target user

  • can_change_info (Optional[bool]) – Pass True if the user can change chat title, photo and other settings

  • can_post_messages (Optional[bool]) – Pass True if the user can post messages in channels

  • can_edit_messages (Optional[bool]) – Pass True if the user can edit messages in channels

  • can_delete_messages (Optional[bool]) – Pass True if the user can delete messages

  • can_invite_users (Optional[bool]) – Pass True if the user can invite new users

  • can_restrict_members (Optional[bool]) – Pass True if the user can restrict, ban or unban chat members

  • can_pin_messages (Optional[bool]) – Pass True if the user can pin messages

  • can_promote_members (Optional[bool]) – Pass True if the user can add new administrators

Returns:

True on success

Return type:

bool

async leave()[source]

Leave the chat.

Returns:

True on success

Return type:

bool

async delete_message(message_id)[source]

Delete a message in a chat.

Parameters:

message_id (int) – Unique identifier of the target message

Returns:

True on success

Return type:

bool

async edit_message(message_id, text, reply_markup=None)[source]

Edit a message in a chat.

Parameters:
Returns:

The edited message.

Return type:

Message

async edit_message_reply_markup(message_id, reply_markup)[source]

Edit a message’s reply markup without editing content.

Parameters:
  • message_id (int) – Unique identifier of the target message.

  • reply_markup (Union["InlineKeyboardMarkup", None]) – Reply markup without editing content.

Returns:

The edited message.

Return type:

Message

async is_joined(user_id)[source]

Check if a user is joined to the chat.

Parameters:

user_id (int) – Unique identifier of the target user

Returns:

True if the user is joined to the chat, False otherwise

Return type:

bool

async pin(message_id)[source]

Pin a message in the chat.

Parameters:

message_id (int) – Identifier of a message to pin

Returns:

True on success

Return type:

bool

async unpin(message_id)[source]

Unpin a message in the chat.

Returns:

True on success

Return type:

bool

Parameters:

message_id (int)

async unpin_all()[source]

Unpin all messages in the chat.

Returns:

True on success

Return type:

bool

async set_title(title)[source]

Change the title of a chat.

Parameters:

title (str) – New chat title, 1-255 characters

Returns:

True on success

Return type:

bool

async set_description(description)[source]

Change the description of a chat.

Parameters:

description (str) – New chat description, 0-255 characters

Returns:

True on success

Return type:

bool

async set_photo(photo)[source]

Set the photo of the chat.

Parameters:

photo (str) – Photo to set. Pass a file_id as string to send a photo that exists on the Telegram servers, pass an HTTP URL as a string for Telegram to get a photo from the Internet, or pass “attach://<file_attach_name>” to upload a new photo that exists on the local server.

Returns:

True on success

Return type:

bool

async send_action(action)[source]

Send an action to the chat.

Parameters:

action (objects.enums.ChatAction) – Action to send to the chat

Returns:

True on success

Return type:

bool

async mute(user_id)[source]

Mutes a user in a chat by restricting.

Parameters:

user_id (int) – user id to mute

Returns:

True on success

Return type:

bool

async unmute(user_id)[source]

Unmutes a user in a chat by restricting.

Parameters:

user_id (int) – user id to unmute

Returns:

True on success

Return type:

bool