class Whatsnew
Public Class Methods
Source
# File plugins/whatsnew.rb, line 20 def self.auto_announce_enabled? false end
Source
# File plugins/whatsnew.rb, line 32 def self.bot_can_speak?(channel, bot) return false unless channel (channel.respond_to?(:opped?) && channel.opped?(bot)) || (channel.respond_to?(:voiced?) && channel.voiced?(bot)) end
Source
# File plugins/whatsnew.rb, line 43 def self.bot_message?(message, bot_nicks) bot_nicks.any? { |nick| nick.casecmp?(message.user.nick.to_s) } end
Source
# File plugins/whatsnew.rb, line 39 def self.bot_nicks(bot) ([bot.nick, bot.config.nick] + Array(bot.config.nicks)).compact.map(&:to_s).reject(&:empty?).uniq end
Source
# File plugins/whatsnew.rb, line 16 def self.command_pattern /whatsnew$/i end
Source
# File plugins/whatsnew.rb, line 47 def self.dispatch_command(store: RabbotDb) WhatsnewFeed.command_reply(store: store) end
Source
# File plugins/whatsnew.rb, line 24 def self.poll_announcements(_bot) [] end
Public Instance Methods
Source
# File plugins/whatsnew.rb, line 82 def execute(m) WhatsnewSeed.seed! reply = self.class.dispatch_command return unless reply flood_safe_reply(m, reply) end
Source
# File plugins/whatsnew.rb, line 51 def on_connect(_m) WhatsnewSeed.seed! rescue StandardError nil end
Source
# File plugins/whatsnew.rb, line 57 def on_message(m) return unless m.channel network = bot.config.server channel = m.channel.name nicks = self.class.bot_nicks(bot) if self.class.bot_message?(m, nicks) WhatsnewTracker.handle_build_success( message: m.message.to_s, network: network, channel: channel ) return end WhatsnewTracker.handle_user_command( message: m.message.to_s, network: network, channel: channel ) rescue StandardError nil end