module Crirc::Binding::Handler

Overview

Register hooks to handle the behavior of a system based on a message.

Direct including types

Defined in:

crirc/binding/handler.cr

Constructors

Instance Method Summary

Constructor Detail

def self.new(**opts) #

[View source]

Instance Method Detail

def handle(msg : String) #

[View source]
def handle(msg : Crirc::Protocol::Message) #

Handle one Message It goes through the registred hooks, select the one to trigger. Then, it execute every hooks associated, and send as parameters the current message and the regex match if possible

TODO msg should NEVER be modified in the hook. (copy ? readonly ?)


[View source]
def hooks : Hash(HookTest, Array(Hook)) #

[View source]
def on(command : String, source : HookRule = nil, arguments : HookRule = nil, message : HookRule = nil, &hook : Hook) #

Register a hook on a command name (JOIN, PRIVMSG, ...) and other rules


[View source]