class Yt
Constants
- IRC_CTRL
- IRC_RESET
- STYLE_CHIP
- STYLE_MUTED
- STYLE_SEP
- STYLE_TITLE
Public Class Methods
Source
# File plugins/yt.rb, line 53 def self.decorate(value, style: STYLE_CHIP) YtReport.decorate(value, style: style) end
Source
# File plugins/yt.rb, line 45 def self.format_message(info) YtReport.format_message(info) end
Source
# File plugins/yt.rb, line 49 def self.format_recent(channel_url:, body_line:) YtReport.format_recent(channel_url: channel_url, body_line: body_line) end
Source
# File plugins/yt.rb, line 29 def self.irc_color(fg, bg = nil) YtReport.irc_color(fg, bg) end
Public Instance Methods
Source
# File plugins/yt.rb, line 74 def execute(m, args_text) channel = m.channel trusted = channel && ChannelTrust.trusted_nick?( nick: m.user.nick, channel: channel, user: m.user, network: bot.config.server ) result = YtCommands.dispatch( args_text, bot_nick: bot.nick, network: bot.config.server, nick: m.user.nick, channel: channel&.name, is_op: channel ? channel.opped?(m.user) : false, trusted: trusted, admin_channels: bot.channels.map(&:name) ) if result[:error] themed_flood_safe_reply(m, result[:error]) return end themed_flood_safe_reply(m, result[:reply]) if result[:reply] end
Source
# File plugins/yt.rb, line 65 def listen(m) return if m.user.nick == bot.nick url = YtLookup.find_url(m.message) return unless url safe_reply(m, lookup(url)) end
Source
# File plugins/yt.rb, line 61 def lookup(url, fetch_oembed: YtLookup.method(:default_fetch_oembed), fetch_page: YtLookup.method(:default_fetch_page)) YtLookup.lookup(url, fetch_oembed: fetch_oembed, fetch_page: fetch_page) end