Chat

class bale.Chat(id, type, title, username, first_name, last_name, photo, invite_link)

Bases: BaleObject

This object indicates a 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]

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

Type:

Optional[str]

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()
async send(text, components=None, delete_after=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, delete_after=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, delete_after=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, delete_after=None)

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

await chat.send_contact(Contact('09****', 'first name', 'last name))
async send_document(document, *, caption=None, components=None, delete_after=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, delete_after=None)

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

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

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, delete_after=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, delete_after=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", ...)
async set_photo(photo)

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

await chat.set_photo(bale.InputFile("FILE_ID"))
async unban_chat_member(user, *, only_if_banned=None)

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

user = await bot.get_user(1234)
await chat.unban_chat_member(user)
...
await chat.unban_chat_member(1234)