Class: CampfireBot::AbsenteeCamper::Plugin
- Inherits:
-
Plugin
- Object
- Plugin
- CampfireBot::AbsenteeCamper::Plugin
- Includes:
- Config, Notification
- Defined in:
- lib/campfire_bot/absentee_camper.rb
Instance Method Summary collapse
-
#initialize ⇒ Plugin
constructor
A new instance of Plugin.
- #role_call(msg) ⇒ Object
Methods included from Config
Constructor Details
Instance Method Details
#role_call(msg) ⇒ Object
22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/campfire_bot/absentee_camper.rb', line 22 def role_call(msg) room = msg[:room] body = msg['body'] body.scan(/@\w+/).map(&:downcase).uniq.each do |mention| mentioned = mention[1..-1] if plugin_config['users'].keys.include? mentioned # If the user isn't in the room, fire off a notification unless room.users.map { |u| u['id'] }.include? user_id_from_config(mentioned) NotificationManager.new(msg, plugin_config['users'][mentioned]).send_notifications room.speak("[Notified #{mentioned}]") end end end end |