Class: BotMob::Bot
- Inherits:
-
Object
- Object
- BotMob::Bot
- Extended by:
- Forwardable
- Defined in:
- lib/bot_mob/bot.rb
Overview
## BotMob::Bot
This is the base for all bots that will connect to Slack.
Instance Attribute Summary collapse
-
#external_id ⇒ Object
readonly
Returns the value of attribute external_id.
Instance Method Summary collapse
- #api_post(args = {}) ⇒ Object
- #connection ⇒ Object
-
#initialize(external_id, token) ⇒ Bot
constructor
A new instance of Bot.
- #realtime_post(args = {}) ⇒ Object
- #respond(message) ⇒ Object
- #respond?(message) ⇒ Boolean
Constructor Details
#initialize(external_id, token) ⇒ Bot
Returns a new instance of Bot.
14 15 16 17 |
# File 'lib/bot_mob/bot.rb', line 14 def initialize(external_id, token) @external_id = external_id @token = token end |
Instance Attribute Details
#external_id ⇒ Object (readonly)
Returns the value of attribute external_id.
9 10 11 |
# File 'lib/bot_mob/bot.rb', line 9 def external_id @external_id end |
Instance Method Details
#api_post(args = {}) ⇒ Object
19 20 21 22 |
# File 'lib/bot_mob/bot.rb', line 19 def api_post(args = {}) BotMob.logger.info(" Sending \"#{args.inspect}\"\n") client.web_client.chat_postMessage(args) end |
#connection ⇒ Object
37 38 39 |
# File 'lib/bot_mob/bot.rb', line 37 def connection @connection ||= BotMob::Connection.new(:slack, self, @token) end |
#realtime_post(args = {}) ⇒ Object
24 25 26 27 |
# File 'lib/bot_mob/bot.rb', line 24 def realtime_post(args = {}) BotMob.logger.info(" Sending \"#{args[:text]}\"\n") client.(args) end |
#respond(message) ⇒ Object
29 30 31 |
# File 'lib/bot_mob/bot.rb', line 29 def respond() # noop end |
#respond?(message) ⇒ Boolean
33 34 35 |
# File 'lib/bot_mob/bot.rb', line 33 def respond?() false end |