abstract class PrivateParlorXT::Handler

Overview

The base class for all message handlers

Direct Known Subclasses

Defined in:

private-parlor-xt/handler.cr

Constructors

Instance Method Summary

Constructor Detail

def self.new(config : Config) #

Initializes an instance of Handler

The config can be used to modify the functionality of the handler


[View source]

Instance Method Detail

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

The function that describes the behavior of the Handler


[View source]
def reply_message(user : User, message : Tourmaline::Message, services : Services) : Tourmaline::Message | Nil #

Returns the given message's reply, if it exists


[View source]
def reply_user(user : User, reply_message : Tourmaline::Message, services : Services) : User | Nil #

Returns the reply_message's User if he exists and the reply_message is still available in the History


[View source]
def unique?(user : User, message : Tourmaline::Message, services : Services, text : String | Nil = nil) : Bool #

Checks the given message for uniqueness and returns true if the message is unique

Returns false if the message is unoriginal


[View source]
def update_user_activity(user : User, services : Services) : Nil #

Updates the given user's last_active attribute to the current time


[View source]