before_anything

If it's called in the current context of the conversation, it will always be executed, at the beginning of the block matching process.

This is one of the exceptional blocks that when executed does not stop the matching process for subsequent blocks.

before_anything(&block)

Platforms

Usage

In the example below, before_anything and any_text will always be executed on arrival of a text message:

class MainContext < Conversation

  def blocks

    before_anything do
       logger.debug "This block is executed Before any other block in this context"
    end
    
    any_text do |text|
       @reply.text "You've sent me '#{text}'"
    end

  end

end

Last updated