Skip to content

Commit

Permalink
Cleaned up some code, and added case-insensitive commands
Browse files Browse the repository at this point in the history
  • Loading branch information
Namasteh committed Aug 1, 2014
1 parent 484de30 commit bbd5709
Show file tree
Hide file tree
Showing 38 changed files with 1,997 additions and 1,801 deletions.
180 changes: 91 additions & 89 deletions lib/plugins/act_ai.rb

Large diffs are not rendered by default.

72 changes: 38 additions & 34 deletions lib/plugins/admin_handler.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,22 +9,22 @@ class AdminHandler

set :plugin_name, 'adminhandler'
set :help, <<-USAGE.gsub(/^ {6}/, '')
Commands to handle the masters of the bot.
Usage:
* !add-master <user>: Adds <user> as master, must be authenticated with NickServ.
* !del-master <user>: Deletes <user> as a master of the bot.
USAGE
match /add-master (.+)/, method: :set_master
match /del-master (.+)/, method: :del_master
Commands to handle the masters of the bot.
Usage:
* !add-master <user>: Adds <user> as master, must be authenticated with NickServ.
* !del-master <user>: Deletes <user> as a master of the bot.
USAGE


match /add-master (.+)/i, method: :set_master

match /del-master (.+)/i, method: :del_master

def set_master(m, target)
unless check_master(m.user)
m.reply Format(:red, "You are not authorized to use that command!")
return;
end
return;
end
mas = User(target)
sleep config[:delay] || 4
mas.refresh
Expand All @@ -35,33 +35,37 @@ def set_master(m, target)
update_store
m.reply "Added #{User(target).nick} as a master!"
end
def del_master(m, target)
unless check_master(m.user)
m.reply Format(:red, "You are not authorized to use that command!")
return;
end
if @storage.key?(User(target).nick)
if @storage[User(target).nick].key? 'master'
mas = @storage[User(target).nick]
mas.delete('master')
update_store
m.reply "Deleted #{User(target).nick} from the masters list"

def del_master(m, target)
unless check_master(m.user)
m.reply Format(:red, "You are not authorized to use that command!")
return;
end
if @storage.key?(User(target).nick)
if @storage[User(target).nick].key? 'master'
mas = @storage[User(target).nick]
mas.delete('master')
update_store
m.reply "Deleted #{User(target).nick} from the masters list"
else
m.reply "#{User(target).nick} isn't a master!"
end
end
end

def update_store
synchronize(:update) do
File.open('docs/userinfo.yaml', 'w') do |fh|
YAML.dump(@storage, fh)

def update_store
synchronize(:update) do
File.open('docs/userinfo.yaml', 'w') do |fh|
YAML.dump(@storage, fh)
end
end
end
end
end
end
end



## Written by Richard Banks for Eve-Bot "The Project for a Top-Tier IRC bot.
## E-mail: namaste@rawrnet.net
## Github: Namasteh
## Website: www.rawrnet.net
## IRC: irc.sinsira.net #Eve
## If you like this plugin please consider tipping me on gittip
Loading

0 comments on commit bbd5709

Please sign in to comment.