abstract class PrivateParlorXT::CommandHandler
- PrivateParlorXT::CommandHandler
- PrivateParlorXT::Handler
- Reference
- Object
Overview
A base class for handling a Telegram command
Handlers that are meant to respond to commands (messages that start with '/') should inherit this class,
and include a RespondsTo
annotation to have it be usable by the bot.
Direct Known Subclasses
- PrivateParlorXT::BlacklistCommand
- PrivateParlorXT::DeleteCommand
- PrivateParlorXT::DemoteCommand
- PrivateParlorXT::HelpCommand
- PrivateParlorXT::InfoCommand
- PrivateParlorXT::KarmaInfoCommand
- PrivateParlorXT::KarmaSignCommand
- PrivateParlorXT::MotdCommand
- PrivateParlorXT::PinCommand
- PrivateParlorXT::PrivacyPolicyCommand
- PrivateParlorXT::PromoteCommand
- PrivateParlorXT::PurgeCommand
- PrivateParlorXT::RanksayCommand
- PrivateParlorXT::RemoveCommand
- PrivateParlorXT::RevealCommand
- PrivateParlorXT::SignCommand
- PrivateParlorXT::SpoilerCommand
- PrivateParlorXT::StartCommand
- PrivateParlorXT::StatsCommand
- PrivateParlorXT::StopCommand
- PrivateParlorXT::ToggleDebugCommand
- PrivateParlorXT::ToggleKarmaCommand
- PrivateParlorXT::TripcodeCommand
- PrivateParlorXT::TripcodeSignCommand
- PrivateParlorXT::UnblacklistCommand
- PrivateParlorXT::UncooldownCommand
- PrivateParlorXT::UnpinCommand
- PrivateParlorXT::UsersCommand
- PrivateParlorXT::VersionCommand
- PrivateParlorXT::WarnCommand
- PrivateParlorXT::WhitelistCommand
Defined in:
private-parlor-xt/handlers/command_handler.crInstance Method Summary
-
#authorized?(user : User, message : Tourmaline::Message, permission : CommandPermissions, services : Services) : Bool
Checks if the user's
Rank
contain the givenCommandPermissions
-
#authorized?(user : User, message : Tourmaline::Message, services : Services, *permissions : CommandPermissions) : CommandPermissions | Nil
Checks if the user's
Rank
contains any of the givenCommandPermissions
-
#delete_messages(message : MessageID, user : UserID, debug_enabled : Bool | Nil, services : Services) : MessageID | Nil
Deletes the message group associated with the given message ID in the chat and from the
History
-
#deny_user(user : User, services : Services) : Nil
Queues a system reply when the user is blacklisted and cannot use a command
-
#remove_command_entity(text : String, entities : Array(Tourmaline::MessageEntity), arg : String) : Array(Tourmaline::MessageEntity)
Removes the bot command message entity from entities and subtracts the index of the arg start from the offset of each message entity in entities
-
#user_from_message(message : Tourmaline::Message, services : Services) : User | Nil
Gets the
User
with updated names from the given message and returns it if the message is a command, the user exists, and the user is not blacklisted
Instance methods inherited from class PrivateParlorXT::Handler
do(message : Tourmaline::Message, services : Services) : Nil
do,
reply_message(user : User, message : Tourmaline::Message, services : Services) : Tourmaline::Message | Nil
reply_message,
reply_user(user : User, reply_message : Tourmaline::Message, services : Services) : User | Nil
reply_user,
unique?(user : User, message : Tourmaline::Message, services : Services, text : String | Nil = nil) : Bool
unique?,
update_user_activity(user : User, services : Services) : Nil
update_user_activity
Constructor methods inherited from class PrivateParlorXT::Handler
new(config : Config)
new
Instance Method Detail
Checks if the user's Rank
contain the given CommandPermissions
Returns true
if it does, false
otherwise
Checks if the user's Rank
contains any of the given CommandPermissions
If it does, it returns the one CommandPermissions
Returns nil
otherwise
Deletes the message group associated with the given message ID in the chat and from the History
Returns the original MessageID
of the associated message group
Queues a system reply when the user is blacklisted and cannot use a command
Removes the bot command message entity from entities and subtracts the index of the arg start from the offset of each message entity in entities
Returns an array of updated Tourmaline::MessageEntity
Gets the User
with updated names from the given message and returns it if the message is a command, the user exists, and the user is not blacklisted