Chat

class bale.Chat(chat_id, chat_type, title=MissingValue, username=MissingValue, first_name=MissingValue, last_name=MissingValue, photo=MissingValue, invite_link=MissingValue)

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:

str, optional

username

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

Type:

str, optional

first_name

First name of the other party in a private chat.

Type:

str, optional

last_name

Last name of the other party in a private chat.

Type:

str, optional

photo

Chat photo.

Type:

bale.ChatPhoto, optional

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

Type:

str, optional

async add_user(user)

Shortcut method for:

await bot.invite_user(
    chat_id=chat.id, *args, **kwargs
)

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

Hint

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

Shortcut method for:

await bot.ban_chat_member(
    chat_id=chat.id, *args, **kwargs
)

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

Hint

user = await bot.get_user(1234)
await chat.ban_member(user)
...
await chat.ban_member(1234)
async copy_message(chat_id, message_id, reply_to_message_id=MissingValue, delete_after=None)

Shortcut method for:

await bot.copy_message(
    from_chat_id=chat.id, message_id=message.id, *args, **kwargs
)

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

Hint

await chat.copy_message(
    1234, 1234
)
async get_administrators()

Shortcut method for:

await bot.get_chat_administrators(
    chat_id=chat.id
)

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

Hint

await chat.get_administrators()
async get_member(user)

Shortcut method for:

await bot.get_chat_member(
    chat_id=chat.id, *args, **kwargs
)

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

Hint

user = await bot.get_user(1234)
await chat.get_member(user)
...
await chat.get_member(1234)
async get_members_count()

Shortcut method for:

await bot.get_chat_members_count(
    chat_id=chat.id
)

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

Hint

await chat.get_members_count()
async leave()

Shortcut method for:

await bot.leave_chat(
    chat_id=chat.id, *args, **kwargs
)

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

Hint

chat = await bot.get_chat(1234)
await chat.leave()
async send(text, components=MissingValue, delete_after=None)

Shortcut method for:

await bot.send_message(
    chat_id=chat.id, *args, **kwargs
)

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

Hint

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

Shortcut method for:

await bot.send_animation(
    chat_id=chat.id, *args, **kwargs
)

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

Hint

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

Shortcut method for:

await bot.send_audio(
    chat_id=chat.id, *args, **kwargs
)

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

Hint

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

Shortcut method for:

await bot.send_contact(
    chat_id=chat.id, *args, **kwargs
)

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

Hint

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

Shortcut method for:

await bot.send_document(
    chat_id=chat.id, *args, **kwargs
)

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

Hint

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

Shortcut method for:

await bot.send_invoice(
    chat_id=chat.id, *args, **kwargs
)

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

Hint

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

Shortcut method for:

await bot.send_location(
    chat_id=chat.id, *args, **kwargs
)

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

Hint

await chat.send_location(bale.Location(35.71470468031143, 51.8568519168293))
async send_media_group(media, *, components=MissingValue)

Shortcut method for:

await bot.send_media_group(
    chat_id=chat.id, *args, **kwargs
)

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

Hint

await chat.send_media_group([
    InputMediaPhoto("File ID", caption="example caption"),
    InputMediaPhoto("File ID"),
    InputMediaPhoto("File ID")
], ...)
async send_photo(photo, *, caption=MissingValue, components=MissingValue, delete_after=None, file_name=None)

Shortcut method for:

await bot.send_photo(
    chat_id=chat.id, *args, **kwargs
)

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

Hint

await chat.send_photo(bale.InputFile("FILE_ID"), caption = "this is caption", ...)
async send_sticker(sticker, *, delete_after=None)

Shortcut method for:

await bot.send_sticker(
    chat_id=chat.id, *args, **kwargs
)

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

Hint

await chat.send_sticker("FILE_ID", ...)
async send_video(video, *, caption=MissingValue, components=MissingValue, delete_after=None, file_name=None)

Shortcut method for:

await bot.send_video(
    chat_id=chat.id, *args, **kwargs
)

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

Hint

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

Shortcut method for:

await bot.set_chat_photo(
    chat_id=chat.id, *args, **kwargs
)

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

Hint

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

Shortcut method for:

await bot.unban_chat_member(
    chat_id=chat.id, *args, **kwargs
)

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

Hint

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