class Libs
Constants
- LIB_DIR
- RABBOT_ROOT
Public Class Methods
Source
# File plugins/libs.rb, line 32 def self.admin_allowed?(network:, channel:, nick:, is_op:) RabbotDb.user_allowed_at_level?( network: network, channel: channel, nick: nick, is_op: is_op, minimum: RabbotDb::LEVEL_ADMIN ) end
Source
# File plugins/libs.rb, line 22 def self.command_pattern /libs(?:\s+(.+))?$/i end
Source
# File plugins/libs.rb, line 42 def self.handle(args, lib_dir: LIB_DIR, admin_allowed:) return [:error, LibsReport.denial] unless admin_allowed filter = args.to_s.strip filter = nil if filter.empty? names = LibsCatalog.list(lib_dir: lib_dir, filter: filter) return [:error, LibsReport.empty(filter)] if names.empty? [:ok, LibsReport.list(names, filter: filter)] end
Source
# File plugins/libs.rb, line 28 def self.responds_to_command?(bot) BotIdentity.owner_bot?(bot) end
Public Instance Methods
Source
# File plugins/libs.rb, line 53 def execute(m, args = nil) return unless self.class.responds_to_command?(bot) network = bot.config.server channel = m.channel&.name return unless channel status, message = self.class.handle( args, admin_allowed: self.class.admin_allowed?( network: network, channel: channel, nick: m.user.nick, is_op: m.channel.opped?(m.user) ) ) _ = status themed_flood_safe_reply(m, message, plugin: "libs") end