Chat

class bale.Chat(chat_id, type, title=None, username=None, first_name=None, last_name=None, photo=None, pinned_message=None, all_members_are_administrators=None, invite_link=None, bot=None)

Bases: object

This object indicates a chat.

chat_id

Unique identifier for this chat.

Type:

str

type

Type of chat.

Type:

str

title

Title, for channels and group chats.

Type:

Optional[str]

username

Username, for private chats, supergroups and channels if available.

Type:

Optional[str]

first_name

First name of the other party in a private chat.

Type:

Optional[str]

last_name

Last name of the other party in a private chat.

Type:

Optional[str]

photo

Chat photo.

Type:

Optional[bale.ChatPhoto]

pinned_message

Pinned messages in chat. Defaults to None.

Type:

Optional[bale.Message]

Primary invite link, for groups and channel. Returned only in bale.Bot.get_chat().

Type:

Optional[str]

all_members_are_administrators

Returns True when all users are in admin chat.

Type:

bool

async add_user(user)

For the documentation of the arguments, please see bale.Bot.invite_user().

user = await bot.get_user(1234)
await chat.add_user(user)
async ban_chat_member(user)

For the documentation of the arguments, please see bale.Bot.ban_chat_member().

user = await bot.get_user(1234)
await chat.ban_chat_member(user)
...
await chat.ban_chat_member(1234)
async get_chat_administrators()

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

await chat.get_chat_administrators()
async get_chat_member(user)

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

user = await bot.get_user(1234)
await chat.get_chat_member(user)
...
await chat.get_chat_member(1234)
async get_chat_members_count()

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

await chat.get_chat_members_count()
async leave()

For the documentation of the method, please see bale.Bot.leave_chat().

chat = await bot.get_chat(1234)
await chat.leave()
property parsed_type

Represents the parsed type of chat.

Type:

bale.ChatType

async send(text, components=None)

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

await chat.send("hi, python-bale-bot!", components = None)
async send_animation(animation, *, duration=None, width=None, height=None, caption=None, components=None)

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

await chat.send_animation(bale.InputFile("FILE_ID"), caption = "this is caption", ...)
async send_audio(audio, *, caption=None, components=None)

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

await chat.send_audio(bale.InputFile("FILE_ID"), caption = "this is caption", ...)
async send_contact(contact)

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

await chat.send_contact(ContactMessage('09****', 'first name', 'last name))
async send_document(document, *, caption=None, components=None)

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

await chat.send_document(bale.InputFile("FILE_ID"), caption = "this is caption", ...)
async send_invoice(title, description, provider_token, prices, *, payload=None, photo_url=None, need_name=False, need_phone_number=False, need_email=False, need_shipping_address=False, is_flexible=True)

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

await chat.send_invoice(
    "invoice title", "invoice description", "6037************", [bale.Price("label", 2000)],
    payload = "unique invoice payload", ...
)
async send_location(location)

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

await chat.send_location(bale.Location(35.71470468031143, 51.8568519168293))
async send_photo(photo, *, caption=None, components=None)

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

await chat.send_photo(bale.InputFile("FILE_ID"), caption = "this is caption", ...)
async send_video(video, *, caption=None, components=None)

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

await chat.send_video(bale.InputFile("FILE_ID"), caption = "this is caption", ...)