module AutoopReport
AutoopReport — auto-op IRC reply cards and announcement formatting. Public: format_announcement, format_reply_card, format_nick_list, format_status_message Depends: IrcFormat, IrcLag Tests: test/plugins/autoop_test.rb
Constants
- IRC_CTRL
- IRC_RESET
- REPLY_TAG
- STYLE_NICK
- STYLE_NUMBER
- STYLE_TEXT
- STYLE_TITLE
Public Instance Methods
Source
# File lib/autoop_report.rb, line 61 def announcement_body(nick, count) "#{STYLE_NICK}#{nick}#{IRC_RESET}#{STYLE_TEXT} is number " \ "#{STYLE_NUMBER}#{count}#{IRC_RESET}#{STYLE_TEXT} to receive auto op#{IRC_RESET}" end
Source
# File lib/autoop_report.rb, line 52 def command_reply_title(message) text = message.to_s return "added" if text.match?(/added/i) return "removed" if text.match?(/removed/i) return "auto op list" if text.match?(/already|not on the auto op list|Only channel ops/i) "auto op" end
Source
# File lib/autoop_report.rb, line 66 def format_announcement(nick, count, lag_ms: 0, ping_ms: nil, server: nil) format_reply_card( title: "auto op", body: announcement_body(nick, count), lag_ms: lag_ms, ping_ms: ping_ms, server: server ) end
Source
# File lib/autoop_report.rb, line 47 def format_command_reply(message, lag_ms: 0, ping_ms: nil, server: nil) title = command_reply_title(message) format_status_message(message, title: title, lag_ms: lag_ms, ping_ms: ping_ms, server: server) end
Source
# File lib/autoop_report.rb, line 76 def format_nick_list(nicks, lag_ms: 0, ping_ms: nil, server: nil) message = if nicks.empty? "#{STYLE_TEXT}The auto op list is empty.#{IRC_RESET}" else formatted_nicks = nicks.map { |nick| "#{STYLE_NICK}#{nick}#{IRC_RESET}" }.join("#{STYLE_TEXT}, #{IRC_RESET}") "#{STYLE_TEXT}auto op list: #{IRC_RESET}#{formatted_nicks}#{IRC_RESET}" end IrcLag.format_one_line( tag: REPLY_TAG, title: "auto op list", body: message, lag_ms: lag_ms, ping_ms: ping_ms, server: server, banner_style: STYLE_TITLE ) end
Source
# File lib/autoop_report.rb, line 30 def format_reply_card(title:, body:, lag_ms: 0, ping_ms: nil, server: nil, tag: REPLY_TAG, banner_style: STYLE_TITLE) IrcLag.format_one_line( tag: tag, title: title, body: body, lag_ms: lag_ms, ping_ms: ping_ms, server: server, banner_style: banner_style ) end
Source
# File lib/autoop_report.rb, line 43 def format_status_message(text, title:, lag_ms: 0, ping_ms: nil, server: nil) format_reply_card(title: title, body: text, lag_ms: lag_ms, ping_ms: ping_ms, server: server) end
Source
# File lib/autoop_report.rb, line 26 def irc_color(fg, bg = nil) IrcFormat.color(fg, bg) end
Source
# File lib/autoop_report.rb, line 94 def non_op_message(lag_ms: 0, ping_ms: nil, server: nil) format_status_message( "Only channel ops can manage the auto op list.", title: "auto op list", lag_ms: lag_ms, ping_ms: ping_ms, server: server ) end
Source
# File lib/autoop_report.rb, line 22 def number_style_colors [1, 8] end