Class: Ant::Bot::Message

Inherits:
Object
  • Object
show all
Defined in:
lib/ant/bot/message.rb

Overview

Base implementation for messages from distinct providers

Direct Known Subclasses

Adapter::DebugMessage

Instance Method Summary collapse

Instance Method Details

#command?Boolean

Returns true when the received message is a command. Convention states that messages should start with ‘/’ to be considered commands

Returns:

  • (Boolean)


20
21
22
# File 'lib/ant/bot/message.rb', line 20

def command?
  raw_message.start_with?('/')
end

#to_hObject

Converts the messages into a hash



11
12
13
14
15
16
# File 'lib/ant/bot/message.rb', line 11

def to_h
  {
    text: raw_message,
    channel: channel_id
  }
end