abstract class PrivateParlorXT::HearsHandler

Overview

A base class for handling messages whose text matches a certain pattern.

Handlers that are meant to match patterns in text should inherit from this class, and include an Hears annotation to have it be usable by the bot.

Direct Known Subclasses

Defined in:

private-parlor-xt/handlers/hears_handler.cr

Instance Method Summary

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 deny_user(user : User, services : Services) : Nil #

Queues a system reply when the message matched is from a user who is blacklisted


[View source]
def karma_reason(reason : String | Nil, karma_reply : String, services : Services) : String #

Format the reason for karma related replies


[View source]
def truncate_karma_reason(reason : String | Nil) : String | Nil #

Return the first 500 characters of the given reason


[View source]