Events Reference
Here you will find a quick summary of all the methods and properties that you can access when working with events.
You can access the client that creates this event by doing
event.client
, and you should view the description of the
events to find out what arguments it allows on creation and
its attributes (the properties will be shown here).
Important
Remember that all events base ChatGetter
! Please see FAQ
if you don’t know what this means or the implications of it.
NewMessage
Occurs whenever a new text message or a message with media arrives.
Note
The new message event should be treated as a
normal Message
, with
the following exceptions:
pattern_match
is the match object returned bypattern=
.message
is not the message string. It’s theMessage
object.
Remember, this event is just a proxy over the message, so while you won’t see its attributes and properties, you can still access them. Please see the full documentation for examples.
Full documentation for the NewMessage
.
MessageEdited
Occurs whenever a message is edited. Just like NewMessage
, you should treat
this event as a Message
.
Full documentation for the MessageEdited
.
MessageDeleted
Occurs whenever a message is deleted. Note that this event isn’t 100% reliable, since Telegram doesn’t always notify the clients that a message was deleted.
It only has the deleted_id
and deleted_ids
attributes
(in addition to the chat if the deletion happened in a channel).
Full documentation for the MessageDeleted
.
MessageRead
Occurs whenever one or more messages are read in a chat.
Full documentation for the MessageRead
.
|
|
The IDs of the messages which contents' were read. |
|
Returns the list of |
|
Returns |
ChatAction
Occurs on certain chat actions, such as chat title changes, user join or leaves, pinned messages, photo changes, etc.
Full documentation for the ChatAction
.
The user who added |
|
The user who kicked |
|
The first user that takes part in this action. |
|
Input version of the |
|
Returns the marked signed ID of the first user, if any. |
|
A list of users that take part in this action. |
|
Input version of the |
|
Returns the marked signed ID of the users, if any. |
|
Responds to the chat action message (not as a reply). |
|
Replies to the chat action message (as a reply). |
|
Deletes the chat action message. |
|
If |
|
Returns |
|
Returns |
|
Returns |
|
Returns |
|
Returns |
|
Returns |
UserUpdate
Occurs whenever a user goes online, starts typing, etc.
Full documentation for the UserUpdate
.
Alias for |
|
Alias for |
|
Alias for |
|
Alias for |
|
Alias for |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Exact |
|
The |
|
|
|
|
|
|
|
|
CallbackQuery
Occurs whenever you sign in as a bot and a user clicks one of the inline buttons on your messages.
Full documentation for the CallbackQuery
.
Returns the query ID. |
|
Returns the message ID to which the clicked inline button belongs. |
|
Returns the data payload from the original inline button. |
|
Unique identifier for the chat where the callback occurred. |
|
Whether this callback was generated from an inline button sent via an inline query or not. |
|
Responds to the message (not as a reply). |
|
Replies to the message (as a reply). |
|
Edits the message. |
|
Deletes the message. |
|
Answers the callback query (and stops the loading circle). |
|
Returns the message to which the clicked inline button belongs. |
InlineQuery
Occurs whenever you sign in as a bot and a user
sends an inline query such as @bot query
.
Full documentation for the InlineQuery
.
Returns the unique identifier for the query ID. |
|
Returns the text the user used to make the inline query. |
|
The string the user's client used as an offset for the query. |
|
If the user location is requested when using inline mode and the user's device is able to send it, this will return the GeoPoint with the position of the user. |
|
Returns a new |
|
Answers the inline query with the given results. |
Album
Occurs whenever you receive an entire album.
Full documentation for the Album
.
The shared |
|
The message text of the first photo with a caption, formatted using the client's default parse mode. |
|
The raw message text of the first photo with a caption, ignoring any formatting. |
|
|
|
The |
|
Responds to the album (not as a reply). |
|
Replies to the first photo in the album (as a reply). |
|
Forwards the entire album. |
|
Edits the first caption or the message, or the first messages' caption if no caption is set, iff it's outgoing. |
|
Deletes the entire album. |
|
Marks the entire album as read. |
|
Pins the first photo in the album. |
Raw
Raw events are not actual events. Instead, they are the raw Update object that Telegram sends. You normally shouldn’t need these.