diff options
author | David Vazgenovich Shakaryan <dvshakaryan@gmail.com> | 2014-04-21 12:17:58 -0700 |
---|---|---|
committer | David Vazgenovich Shakaryan <dvshakaryan@gmail.com> | 2014-04-21 12:17:58 -0700 |
commit | 6ff901dfe723b58ad13a2e3693473d934f5751b2 (patch) | |
tree | 010a86fccc8ec0fcef0256c7cc06516308cab92f /module/admin.rb | |
parent | 6f983f20925e6c1b95649f221fb9fd419a44f025 (diff) | |
download | dinobot-6ff901dfe723b58ad13a2e3693473d934f5751b2.tar.gz dinobot-6ff901dfe723b58ad13a2e3693473d934f5751b2.tar.xz |
Modify modules to accept MessageInfo objects.
Diffstat (limited to 'module/admin.rb')
-rw-r--r-- | module/admin.rb | 54 |
1 files changed, 26 insertions, 28 deletions
diff --git a/module/admin.rb b/module/admin.rb index 1a081df..72c2a14 100644 --- a/module/admin.rb +++ b/module/admin.rb @@ -35,60 +35,58 @@ module Dinobot @admins.include?(user.sub(/.+@/, '')) end - def join(user, channel, argument) - return unless is_admin?(user) + def join(m, args) + return unless is_admin?(m.user) - [[:join, argument.strip]] + m.response << [:join, args.strip] end - def part(user, channel, argument) - return unless is_admin?(user) + def part(m, args) + return unless is_admin?(m.user) - [[:part, argument.strip]] + m.response << [:part, args.strip] end - def quit(user, channel, argument) - return unless is_admin?(user) + def quit(m, args) + return unless is_admin?(m.user) - [[:quit, argument ? argument.strip : 'Quitting.']] + m.response << [:quit, args ? args.strip : 'Quitting.'] end - def load(user, channel, argument) - return unless is_admin?(user) + def load(m, args) + return unless is_admin?(m.user) - argument.split.each do |x| + args.split.each do |x| @bot.load_module x.intern end - - nil end - def unload(user, channel, argument) - return unless is_admin?(user) + def unload(m, args) + return unless is_admin?(m.user) - argument.split.each do |x| + args.split.each do |x| @bot.unload_module x.intern end - - nil end - def listadmins(user, channel, argument) - return unless is_admin?(user) + def listadmins(m, args) + return unless is_admin?(m.user) - [[:say, channel, "Admins: #{@admins.join(' ')}"]] + m.response << [:say, m.channel, "Admins: #{@admins.join(' ')}"] end - def listmodules(user, channel, argument) - return unless is_admin?(user) + def listmodules(m, args) + return unless is_admin?(m.user) - [[:say, channel, "Modules: #{@bot.modules.keys.sort.join(' ')}"]] + m.response << [:say, m.channel, + "Modules: #{@bot.modules.keys.sort.join(' ')}"] end - def listchannels(user, channel, argument) - return unless is_admin?(user) + def listchannels(m, args) + return unless is_admin?(m.user) - [[:say, channel, "Channels: #{@bot.channels.sort.join(' ')}"]] + m.response << [:say, m.channel, + "Channels: #{@bot.channels.sort.join(' ')}"] end end end |