module BannerFontReport
BannerFontReport โ IRC cards for !bannerletter and !bannerfont replies. Public: help, pm_error, letter_show, letter_set, letter_reset, char_show, char_set, char_reset, list, active, applied, show, deleted, reset Depends: IrcReply, BannerFontStore, BannerFont Tests: test/lib/banner_letter_command_test.rb, test/lib/banner_font_command_test.rb
Constants
- STYLE_TITLE
- TAG
Public Instance Methods
Source
# File lib/banner_font_report.rb, line 110 def active_font(name) IrcReply.card( tag: TAG, title: "active font", body_lines: ["Active blocks font: #{name}"], footer_parts: ["!bannerfont use <name> to change"] ) end
Source
# File lib/banner_font_report.rb, line 119 def applied(name) IrcReply.card( tag: TAG, title: "#{name} applied", body_lines: ["Active blocks font set to #{name}."], footer_parts: ["blocks engine"] ) end
Source
# File lib/banner_font_report.rb, line 93 def char_reset(letter) letter_reset(letter) end
Source
# File lib/banner_font_report.rb, line 84 def char_set(letter, width:) IrcReply.card( tag: TAG, title: "letter #{letter} saved", body_lines: ["Glyph updated at width #{width} in the active blocks font."], footer_parts: ["!bannerchar #{letter} to preview"] ) end
Source
# File lib/banner_font_report.rb, line 75 def char_show(letter, rows, width:) IrcReply.card( tag: TAG, title: "letter #{letter}", body_lines: rows, footer_parts: ["blocks font", "width #{width}", "#{BannerFont::HEIGHT} rows"] ) end
Source
# File lib/banner_font_report.rb, line 128 def created(name) IrcReply.card( tag: TAG, title: "#{name} created", body_lines: ["Forked current glyphs into #{name} and switched to it."], footer_parts: ["blocks font"] ) end
Source
# File lib/banner_font_report.rb, line 137 def deleted(name) IrcReply.card( tag: TAG, title: "#{name} deleted", body_lines: ["Removed custom font #{name}."], footer_parts: ["active: default"] ) end
Source
# File lib/banner_font_report.rb, line 44 def error(message) IrcReply.error(tag: TAG, message: message, heading_style: STYLE_TITLE) end
Source
# File lib/banner_font_report.rb, line 19 def help IrcReply.card( tag: TAG, title: "blocks fonts", body_lines: [ "!bannerfont list โ built-in default + custom fonts", "!bannerfont active โ current channel font", "!bannerfont use <name> โ switch font", "!bannerfont new <name> โ fork current glyphs into a new font", "!bannerfont show [name] โ preview customized letters", "!bannerfont reset [char] โ clear overrides in active font", "!bannerfont delete <name> โ remove a custom font", "!bannerletter <letter> โ show glyph rows", "!bannerletter <letter> <row1> <row2> <row3> <row4> โ set glyph rows", "!bannerchar <char> โ show glyph rows and width", "!bannerchar <width> <char> <joined-ascii> โ set glyph at explicit width" ], footer_parts: ["blocks engine only", "channel"] ) end
Source
# File lib/banner_font_report.rb, line 66 def letter_reset(letter) IrcReply.card( tag: TAG, title: "letter #{letter} reset", body_lines: ["Restored the built-in default glyph."], footer_parts: ["blocks font"] ) end
Source
# File lib/banner_font_report.rb, line 57 def letter_set(letter) IrcReply.card( tag: TAG, title: "letter #{letter} saved", body_lines: ["Glyph updated in the active blocks font."], footer_parts: ["!bannerletter #{letter} to preview"] ) end
Source
# File lib/banner_font_report.rb, line 48 def letter_show(letter, rows) IrcReply.card( tag: TAG, title: "letter #{letter}", body_lines: rows, footer_parts: ["blocks font", "#{BannerFont::HEIGHT} rows"] ) end
Source
# File lib/banner_font_report.rb, line 97 def list(active:, custom:) entries = ["default"] entries.concat(custom.reject { |name| name == BannerFontStore::DEFAULT_FONT }) body = entries.map { |name| name == active ? "#{name}*" : name }.join(", ") IrcReply.card( tag: TAG, title: "blocks fonts", body_lines: [body], footer_parts: ["active: #{active}", "#{entries.length} fonts"] ) end
Source
# File lib/banner_font_report.rb, line 40 def pm_error IrcReply.error(tag: TAG, message: "Use !bannerletter and !bannerfont in a channel, not in PM.", heading_style: STYLE_TITLE) end
Source
# File lib/banner_font_report.rb, line 146 def reset_scope(letter: nil) title = letter ? "letter #{letter} reset" : "font reset" body = letter ? "Cleared override for #{letter}." : "Cleared all overrides in the active font." IrcReply.card( tag: TAG, title: title, body_lines: [body], footer_parts: ["blocks font"] ) end
Source
# File lib/banner_font_report.rb, line 157 def show_font(name, letters, glyphs:) lines = letters.first(4).map do |letter| rows = glyphs[letter] || BannerFont::GLYPHS[letter] "#{letter}: #{rows.join(' ยท ')}" end more = letters.length > 4 ? ["โฆ #{letters.length - 4} more letters"] : [] IrcReply.card( tag: TAG, title: "font #{name}", body_lines: lines.empty? ? ["No customized letters."] : lines + more, footer_parts: ["#{letters.length} customized", "blocks"] ) end