summaryrefslogtreecommitdiff
path: root/data
diff options
context:
space:
mode:
Diffstat (limited to 'data')
-rw-r--r--data/rbot/plugins/cal.rb2
-rw-r--r--data/rbot/plugins/nickserv.rb92
-rw-r--r--data/rbot/templates/levels.rbot22
3 files changed, 54 insertions, 62 deletions
diff --git a/data/rbot/plugins/cal.rb b/data/rbot/plugins/cal.rb
index 4f28310b..dd1d1538 100644
--- a/data/rbot/plugins/cal.rb
+++ b/data/rbot/plugins/cal.rb
@@ -1,6 +1,6 @@
class CalPlugin < Plugin
def help(plugin, topic="")
- "cal [options] => show current calendar [unix cal options]"
+ "cal [month year] => show current calendar [optionally specify month and year]"
end
def cal(m, params)
if params.has_key?(:month)
diff --git a/data/rbot/plugins/nickserv.rb b/data/rbot/plugins/nickserv.rb
index 1ef2baf7..246f253c 100644
--- a/data/rbot/plugins/nickserv.rb
+++ b/data/rbot/plugins/nickserv.rb
@@ -17,6 +17,15 @@ class NickServPlugin < Plugin
end
end
+ def genpasswd
+ # generate a random password
+ passwd = ""
+ 8.times do
+ passwd += (rand(26) + (rand(2) == 0 ? 65 : 97) ).chr
+ end
+ return passwd
+ end
+
def initialize
super
# this plugin only wants to store strings!
@@ -29,49 +38,34 @@ class NickServPlugin < Plugin
end
end
end
-
- def privmsg(m)
- return unless m.params
-
- case m.params
- when (/^password\s*(\S*)\s*(.*)$/)
- nick = $1
- passwd = $2
- @registry[nick] = passwd
- m.okay
- when (/^register$/)
- passwd = genpasswd
- @bot.sendmsg "PRIVMSG", "NickServ", "REGISTER " + passwd
- @registry[@bot.nick] = passwd
- m.okay
- when (/^register\s*(\S*)\s*(.*)$/)
- passwd = $1
- email = $2
- @bot.sendmsg "PRIVMSG", "NickServ", "REGISTER " + passwd + " " + email
- @registry[@bot.nick] = passwd
- m.okay
- when (/^register\s*(.*)\s*$/)
- passwd = $1
- @bot.sendmsg "PRIVMSG", "NickServ", "REGISTER " + passwd
- @registry[@bot.nick] = passwd
+
+ def password(m, params)
+ @registry[params[:nick]] = params[:passwd]
+ m.okay
+ end
+ def nick_register(m, params)
+ passwd = params[:passwd] ? params[:passwd] : genpasswd
+ message = "REGISTER #{passwd}"
+ message += " #{params[:email]}" if params[:email]
+ @bot.sendmsg "PRIVMSG", "NickServ", message
+ @registry[@bot.nick] = passwd
+ m.okay
+ end
+ def listnicks(m, params)
+ if @registry.length > 0
+ @registry.each {|k,v|
+ @bot.say m.sourcenick, "#{k} => #{v}"
+ }
+ else
+ m.reply "none known"
+ end
+ end
+ def identify(m, params)
+ if @registry.has_key?(@bot.nick)
+ @bot.sendmsg "PRIVMSG", "NickServ", "IDENTIFY #{@registry[@bot.nick]}"
m.okay
- when (/^listnicks$/)
- if @bot.auth.allow?("config", m.source, m.replyto)
- if @registry.length > 0
- @registry.each {|k,v|
- @bot.say m.sourcenick, "#{k} => #{v}"
- }
- else
- m.reply "none known"
- end
- end
- when (/^identify$/)
- if @registry.has_key?(@bot.nick)
- @bot.sendmsg "PRIVMSG", "NickServ", "IDENTIFY " + @registry[@bot.nick]
- m.okay
- else
- m.reply "I dunno the nickserv password for the nickname #{@bot.nick} :("
- end
+ else
+ m.reply "I dunno the nickserv password for the nickname #{@bot.nick} :("
end
end
@@ -86,14 +80,10 @@ class NickServPlugin < Plugin
end
end
- def genpasswd
- # generate a random password
- passwd = ""
- 8.times do
- passwd += (rand(26) + (rand(2) == 0 ? 65 : 97) ).chr
- end
- return passwd
- end
end
plugin = NickServPlugin.new
-plugin.register("nickserv")
+plugin.map 'nickserv password :nick :passwd'
+plugin.map 'nickserv register :passwd :email', :action => 'nick_register',
+ :defaults => {:passwd => false, :email => false}
+plugin.map 'nickserv listnicks'
+plugin.map 'nickserv identify'
diff --git a/data/rbot/templates/levels.rbot b/data/rbot/templates/levels.rbot
index 2d11c2df..ce338e3b 100644
--- a/data/rbot/templates/levels.rbot
+++ b/data/rbot/templates/levels.rbot
@@ -1,21 +1,23 @@
-70 say
100 auth
-50 part
+90 quit
85 config
80 nick
+80 nickserv
+80 http
+70 opmeh
+70 say
+50 part
50 join
+15 delquote
12 msginsult
+12 remind+
+5 rmlart
+5 rmpraise
5 keycmd
5 lart
5 addlart
-10 rmlart
5 addpraise
-10 rmpraise
-5 addquote
-12 remind+
-5 getquote
-90 quit
5 remind
5 keyword
-15 delquote
-70 opmeh
+5 addquote
+5 getquote