|
# File rbot/auth.rb, line 166
def privmsg(m)
if(m.address? && m.private?)
case m.message
when (/^setlevel\s+(\S+)\s+(\d+)$/)
if(@bot.auth.allow?("auth", m.source, m.replyto))
@bot.auth.setlevel($1, $2.to_i)
m.reply "level for #$1 set to #$2"
end
when (/^useradd\s+(\S+)\s+(\d+)/)
if(@bot.auth.allow?("auth", m.source, m.replyto))
@bot.auth.useradd($1, $2.to_i)
m.reply "added user #$1 at level #$2"
end
when (/^userdel\s+(\S+)/)
if(@bot.auth.allow?("auth", m.source, m.replyto))
@bot.auth.userdel($1)
m.reply "user #$1 is gone"
end
when (/^auth\s+(\S+)/)
if($1 == @bot.config["passwd"])
@bot.auth.useradd(m.source, 1000)
m.reply "Identified, security level maxed out"
else
m.reply "incorrect password"
end
when ("levels")
m.reply @bot.auth.showlevels if(@bot.auth.allow?("config", m.source, m.replyto))
when ("users")
m.reply @bot.auth.showusers if(@bot.auth.allow?("config", m.source, m.replyto))
end
end
end
|