class Tourmaline::CommandFilter
- Tourmaline::CommandFilter
- Tourmaline::Filter
- Reference
- Object
Overview
Filters messages that include a specific command or commands.
Options:
commands : String | Array(String)
- the command(s) to match (without the prefix)prefix : String
- the prefix that should preceed the command(s)private_only : Bool
- if true, command(s) will only be available in private chatsgroup_only : Bool
- if true, command(s) will only be available in group chatsadmin_only : Bool
if true, command(s) will only work for group admins
Context additions:
command : String
- the matched commandtext : String
- the raw text without the command
Example:
filter = CommandFilter.new("echo")
Defined in:
tourmaline/filters/command_filter.crConstructors
Instance Method Summary
- #admin_only : Bool
- #admin_only=(admin_only : Bool)
- #commands : Array(String)
- #commands=(commands : Array(String))
- #exec(client : Client, update : Update) : Bool
- #group_only : Bool
- #group_only=(group_only : Bool)
- #prefix : String
- #prefix=(prefix : String)
- #private_only : Bool
- #private_only=(private_only : Bool)
Instance methods inherited from class Tourmaline::Filter
&(other : Filter | FilterGroup)
&,
|(other : Filter | FilterGroup)
|,
exec(client : Client, update : Update) : Bool
exec
Constructor Detail
def self.new(commands : String | Array(String), prefix = nil, private_only : Bool = false, group_only : Bool = false, admin_only : Bool = false)
#