PrivateParlorXT::UpdateHandler
Inherits PrivateParlorXT::Handler < Reference < Object
A base class for handling one of the Telegram updates (Tourmaline::Text, Tourmaline::Photo, Tourmaline::ForwardedMessage, etc).
Handlers that are meant to work with Telegram updates should inherit this class,
and include an On annotation to have it be usable by the bot.
Instance methods
Returns true if user is authorized to send this type of message (one of the MessagePermissions types).
Returns false otherwise.
Queues a system reply when the user cannot chat due to being either cooldowned, blacklisted, media limited, or left.
Returns true if the message is not a forward or an album.
Returns false otherwise.
Returns an array of UserID for which the relayed message will be sent to
If the given User has debug mode enabled, he will get a copy of the relayed message
If the statistics module is enabled, update the message_stats for the given type by incrementing the totals.
Returns a hash of a receiver's UserID to the relevant message ID for which this message will reply to when relayed.
When quoting, the ReplyParameters value will contain the replied message's quote if it is not invalid (i.e., user quoted his own message and it had strippable entities or was edited)
The hash will be empty if the message does not have a reply
Returns nil if the message had a reply, but no receiver message IDs could be found (message replied to is no longer in the cache)
Returns the User associated with the message if the User could be found in the Database.
This will also update the User's username and realname if they have changed since the last message.
Returns nil if:
- Message has no sender
- Message is a command
Userdoes not exist in theDatabaseUsercannot chat right now (due to a cooldown, blacklist, media limit, or having left the chat)
Macros
Returns early if the message text contains a command.
Iterates through all HearsHandlers that are meant to be commands,
and returns early if the handler matches a substring in the text (for RegexLiteral patterns)
or if the handler starts with a substring (for StringLiteral patterns)