module FloodSafeTheme
FloodSafeTheme — themed flood_safe_reply wrapper for plugins. Public: themed_flood_safe_reply Depends: ThemeOutput, LolcatOutput, FloodSafe Tests: test/lib/theme_output_test.rb
Public Instance Methods
Source
# File lib/flood_safe_theme.rb, line 42 def reply_channel_name(target) if target.respond_to?(:channel) && target.channel ch = target.channel if ch.is_a?(String) ch elsif ch.respond_to?(:name) ch.name end elsif target.respond_to?(:name) && !target.is_a?(String) target.name end end
Source
# File lib/flood_safe_theme.rb, line 12 def themed_flood_safe_reply(m, text, plugin: nil, with_progress: :auto, skip_prefix_lines: 0, line_byte_limit: nil) plugin_name = (plugin || self.class.name).to_s.downcase network = if bot && !bot.is_a?(Class) && bot.respond_to?(:config) && bot.config bot.config.server end channel = reply_channel_name(m) message = if network && channel themed = ThemeOutput.apply( network: network, channel: channel, plugin: plugin_name, text: text ) LolcatOutput.apply( network: network, channel: channel, text: themed ) else text.to_s end flood_safe_reply( m, message, with_progress: with_progress, skip_prefix_lines: skip_prefix_lines, line_byte_limit: line_byte_limit ) end