User

class bale.User(user_id, is_bot, first_name, last_name=MissingValue, username=MissingValue)

Bases: BaleObject

This object represents a Bale user or bot.

id

Unique identifier for this user or bot.

Type:

int

is_bot

True, if this user is a bot.

Type:

bool, optional

first_name

User’s or bot’s first name.

Type:

str

last_name

User’s or bot’s last name.

Type:

str, optional

username

User’s or bot’s username.

Type:

str, optional

property chat_id

Aliases for id

property mention

mention user with username.

Type:

str, optional

async send(text, components=MissingValue, delete_after=None)

Shortcut method for:

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

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

Hint

await user.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=user.id, *args, **kwargs
)

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

Hint

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

Shortcut method for:

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

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

Hint

await user.send_audio(bale.InputFile("FILE_ID"), caption = "this is a caption", ...)
async send_contact(contact, *, components=MissingValue, delete_after=None)

Shortcut method for:

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

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

Hint

await user.send_contact(bale.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=user.id, *args, **kwargs
)

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

Hint

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

Shortcut method for:

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

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

Hint

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

Shortcut method for:

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

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

Hint

await user.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=user.id, *args, **kwargs
)

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

Hint

await user.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=user.id, *args, **kwargs
)

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

Hint

await user.send_photo(bale.InputFile("FILE_ID"), caption = "this is a caption", ...)
async send_video(video, *, caption=MissingValue, components=MissingValue, delete_after=None, file_name=None)

Shortcut method for:

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

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

Hint

await user.send_video(bale.InputFile("FILE_ID"), caption = "this is a caption", ...)
property user_id

Aliases for id