phpircbot2/commands/user.prefix.php
Jan Philipp Timme 6b39d44754 Initial import.
2010-11-21 22:13:54 +00:00

45 lines
1.4 KiB
PHP

<?php
#BOT_INCLUDE "user" "prefix" "3"
/*
* This file contains code for the prefix-based user-command
*/
$nick = $recv["msgarr"][2];
switch($recv["msgarr"][1]){
case "add":
$pw = md5(rand().time().md5(time()));
$this -> userdb -> addUser($nick, $pw);
$this -> userdb -> setLevel($nick, 1);
$this -> call("notice", $nick, "Your current password: ".$pw);
$this -> call("notice", $nick, "Your current level: 1");
$this -> call("notice", $nick, "In order to change your password, type: /msg ".$this -> nick." identify ".$pw." and /msg ".$this -> nick." password <new password>");
break;
case "del":
$this -> userdb -> delUser($nick);
$this -> call("privmsg", $recv["origin"], "User '".$nick."' deleted.");
break;
case "level":
$this -> userdb -> setLevel($nick, $recv["msgarr"][3]);
$this -> call("notice", $nick, "Your new level: ".$recv["msgarr"][3]);
break;
case "list":
$list = $this -> userdb -> listUsers();
foreach($list as $user => $level){
$users[] = $user."(".$level.")";
}
$this -> call("notice", $recv["nick"], "Users: ".implode(", ", $users));
break;
case "help":
$this -> call("notice", $recv["nick"], "Available commands: list, add <nick>, level <nick> <new level>, del <nick>, help (level 3+)");
break;
default:
$this -> call("notice", $recv["nick"], "Unknown user command! Type ".$this -> prefix."user help for further information");
break;
}
?>