struct
Telecr::Core::Handler
- Telecr::Core::Handler
- Struct
- Value
- Object
Overview
Handler struct - stores user's code and when to run it
Defined in:
core/handler.crConstructors
Instance Method Summary
-
#call(ctx : Context)
Execute the handler with given context
-
#call_count : Int32
How many times this handler has been called (useful for stats)
-
#call_count=(call_count : Int32)
How many times this handler has been called (useful for stats)
-
#created_at : Time
Time this handler was registered
-
#filters : Hash(String, FilterValue)
Filters determine when this handler should run
-
#handle_dynamic_filter(ctx : Context, key : String, value : FilterValue) : Bool
Handle dynamic filter keys without using responds_to? with dynamic symbols
-
#matches?(ctx : Context) : Bool
Check if this handler should run for the given context
- #matches_chat_type?(ctx, type : FilterValue) : Bool
- #matches_command?(ctx, cmd_name : FilterValue) : Bool
- #matches_text?(ctx, pattern : FilterValue) : Bool
-
#proc : Context ->
The actual user code that runs
-
#to_s(io : IO) : Nil
String representation for debugging
Constructor Detail
def self.new(filters : Hash(String, Bool | Int32 | Int64 | Regex | String | Nil), proc : Telecr::Core::Context -> _)
#
Instance Method Detail
def call_count=(call_count : Int32)
#
How many times this handler has been called (useful for stats)
Handle dynamic filter keys without using responds_to? with dynamic symbols
Check if this handler should run for the given context