class PrivateParlorXT::RanksayCommand

Overview

Processes ranksay messages before an UpdateHandler gets them

This handler expects the command handlers to be registered before the update handlers

Defined in:

private-parlor-xt/handlers/command_handlers/ranksay_command.cr

Instance Method Summary

Instance methods inherited from class PrivateParlorXT::CommandHandler

authorized?(user : User, message : Tourmaline::Message, permission : CommandPermissions, services : Services) : Bool
authorized?(user : User, message : Tourmaline::Message, services : Services, *permissions : CommandPermissions) : CommandPermissions | Nil
authorized?
, delete_messages(message : MessageID, user : UserID, debug_enabled : Bool | Nil, services : Services) : MessageID | Nil delete_messages, deny_user(user : User, services : Services) : Nil deny_user, remove_command_entity(text : String, entities : Array(Tourmaline::MessageEntity), arg : String) : Array(Tourmaline::MessageEntity) remove_command_entity, user_from_message(message : Tourmaline::Message, services : Services) : User | Nil user_from_message

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

def do(message : Tourmaline::Message, services : Services) : Nil #

Preformats the given message with a rank name signature if the message meets requirements


[View source]
def get_rank_name(text : String, user : User, message : Tourmaline::Message, authority : CommandPermissions, services : Services) : String | Nil #

For ranksay commands that are not initiated using "/ranksay" and instead uses the name of the rank followed by "-say"

Returns the name of the Rank if the rank in the given text can ranksay

Returns nil otherwise


[View source]
def ranksay(rank : String, arg : String, entities : Array(Tourmaline::MessageEntity)) : Tuple(String, Array(Tourmaline::MessageEntity)) #

Format ranksay signature for the given rank, appending it to the given arg


[View source]
def spamming?(user : User, message : Tourmaline::Message, arg : String, services : Services) : Bool #

Checks if the user is spamming rank signatures

Returns true if the user is spamming rank signatures or unformatted text is spammy, returns false otherwise


[View source]