Message¶
- class bale.Message(message_id, date, text, caption, forward_from, forward_from_chat, forward_from_message_id, from_user, document, contact, edit_date, location, chat, video, photos, sticker, reply_to_message, invoice, audio, successful_payment, animation, new_chat_members, left_chat_member)¶
Bases:
BaleObject
This object shows a message.
- from_user¶
Sender of the message; empty for messages sent to channels. For backward compatibility, this will contain a fake sender user in non-channel chats, if the message was sent on behalf of a chat.
- Type:
Optional[
bale.User
]
- date¶
Date the message was sent in Unix time.
- Type:
Caption for the animation, audio, document, photo, video or voice.
- Type:
Optional[
str
]
- forward_from_chat¶
For messages forwarded from channels or from anonymous administrators, information about the original sender chat.
- Type:
Optional[
bale.Chat
]
- reply_to_message¶
For replies, the original message. Note that the Message object in this field will not contain further reply_to_message fields even if it itself is a reply.
- Type:
Optional[
bale.Message
]
- edit_date¶
Date the message was last edited.
- Type:
Optional[
datetime.datetime
]
- contact¶
Message is a shared contact, information about the contact.
- Type:
Optional[
bale.Contact
]
- location¶
Message is a shared location, information about the location.
- Type:
Optional[
bale.Location
]
- document¶
Message is a general file, information about the file.
- Type:
Optional[
bale.Document
]
- video¶
Message is a video, information about the video.
- Type:
Optional[
bale.Video
]
- animation¶
Message is an animation, information about the animation.
- Type:
Optional[
bale.Animation
]
- audio¶
Message is an audio, information about the Audio.
- Type:
Optional[
bale.Audio
]
- sticker¶
Message is a sticker, information about the sticker.
- Type:
Optional[
bale.Sticker
]
- new_chat_members¶
New members that were added to the group or supergroup and information about them (the bot itself may be one of these members). This list is empty if the message does not contain new chat members.
- Type:
Optional[List[
bale.User
]]
- left_chat_member¶
A member was removed from the group, information about them (this member may be the bot itself).
- Type:
Optional[
bale.User
]
- invoice¶
Message is an invoice for a payment, information about the invoice.
- Type:
Optional[
bale.Invoice
]
- successful_payment¶
Message is a service message about a successful payment, information about the payment.
- Type:
Optional[
bale.SuccessfulPayment
]
- property attachment¶
Represents the message attachment.
None
if the message don’t have any attachments- Type:
Optional[
bale.BaseFile
]
- property chat_id¶
Represents the Unique identifier of Conversation the message belongs to.
- property content¶
Represents the message content.
None
if the message don’t have text or caption- Type:
Optional[
str
]
- async delete(*, delay=None)¶
For the documentation of the arguments, please see
bale.Bot.delete_message()
.await message.delete(delay=5)
- async edit(text, *, components=None)¶
For the documentation of the arguments, please see
bale.Bot.edit_message()
.await message.edit("Bye!", components = None)
- async forward(chat_id)¶
For the documentation of the arguments, please see
bale.Bot.forward_message()
.await message.forward(1234)
- async reply(text, *, components=None, delete_after=None)¶
For the documentation of the arguments, please see
bale.Bot.send_message()
.await message.reply("Hi, python-bale-bot!", components = None)
- async reply_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 message.reply_animation(bale.InputFile("FILE_ID"), caption = "this is a caption", ...)
- async reply_audio(audio, *, caption=None, components=None, delete_after=None)¶
For the documentation of the arguments, please see
bale.Bot.send_audio()
.await message.reply_audio(bale.InputFile("FILE_ID"), caption = "this is a caption", ...)
- async reply_contact(contact, *, components=None, delete_after=None)¶
For the documentation of the arguments, please see
bale.Bot.send_contact()
.await message.reply_contact(bale.Contact('09****', 'first name', 'last name'))
- async reply_document(document, *, caption=None, components=None, delete_after=None)¶
For the documentation of the arguments, please see
bale.Bot.send_document()
.await message.reply_document(bale.InputFile("FILE_ID"), caption = "this is a caption", ...)
- async reply_location(location, *, components=None, delete_after=None)¶
For the documentation of the arguments, please see
bale.Bot.send_audio()
.await message.reply_location(bale.Location(35.71470468031143, 51.8568519168293))
- async reply_photo(photo, *, caption=None, components=None, delete_after=None)¶
For the documentation of the arguments, please see
bale.Bot.send_photo()
.await message.reply_photo(bale.InputFile("FILE_ID"), caption = "this is a caption", ...)
- property reply_to_message_id¶
Represents the Unique identifier of Original message, if the message has been replied.
None
If the message is not replied- Type:
Optional[
str
]
- async reply_video(video, *, caption=None, components=None, delete_after=None)¶
For the documentation of the arguments, please see
bale.Bot.send_video()
.await message.reply_video(bale.InputFile("FILE_ID"), caption = "this is a caption", ...)