annotation Tourmaline::Hears

Overview

Similar to Command, Hears is a more general pattern matcher. Any time a message matches a pattern defined inside of a Hears annotation the annotated method will be fired.

Example:

@[Hears(/^Hello/)]
def respond_to_hello(message)
  send_message(message.chat.id, "Hello to you", respond_to_message: message.message_id)
end

The pattern can be a string, regex, or an array of string/regex.

Defined in:

tourmaline/annotations.cr