class Chan
Public Class Methods
Source
# File plugins/chan.rb, line 36 def self.admin_allowed?(network:, channel:, nick:, is_op:) ChanOps.admin_allowed?(network: network, channel: channel, nick: nick, is_op: is_op) end
Source
# File plugins/chan.rb, line 18 def self.command_pattern /chan(?: (.+))?$/i end
Source
# File plugins/chan.rb, line 28 def self.denied_message ChanOps.denied_message end
Source
# File plugins/chan.rb, line 40 def self.dispatch_command(args_text, user_channels:, bot_channels:, network:, nick:, is_op: false) ChanOps.dispatch_command( args_text, user_channels: user_channels, bot_channels: bot_channels, network: network, nick: nick, is_op: is_op ) end
Source
# File plugins/chan.rb, line 32 def self.parse_command(text) ChanOps.parse_command(text) end
Source
# File plugins/chan.rb, line 24 def self.usage_message ChanOps.usage_message end
Public Instance Methods
Source
# File plugins/chan.rb, line 71 def apply_action(result) channel_name = result[:channel] case result[:action] when :join bot.join(channel_name) when :part bot.part(channel_name, result[:part_message]) else channel = Channel(channel_name) case result[:action] when :op channel.op(result[:target]) when :deop channel.deop(result[:target]) when :voice channel.voice(result[:target]) when :devoice channel.devoice(result[:target]) when :kick channel.kick(result[:target], result[:reason]) when :ban channel.ban(result[:target], result[:reason]) when :unban channel.unban(result[:ban_mask]) when :invite channel.invite(result[:target]) when :topic channel.topic = result[:text] when :mode channel.mode(result[:modes], *Array(result[:mode_args])) end end end
Source
# File plugins/chan.rb, line 51 def execute(m, args_text = nil) return unless BotIdentity.owner_bot?(bot) result = self.class.dispatch_command( args_text, user_channels: m.user.channels.map(&:name), bot_channels: bot.channels.map(&:name), network: bot.config.server, nick: m.user.nick ) if result[:error] themed_flood_safe_reply(m, ChanReport.error(result[:error])) return end apply_action(result) themed_flood_safe_reply(m, result[:private_reply]) end