Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- abstract class mod_operator {
- static $level;
- public static function errorNotOp($e){
- irc::chanmsg($e->sid,$e->chan,"sorry, but i need operator status for that!");
- }
- public static function privmsg ($e){
- $u=user::info($e);
- if (isset($u['level'])) {
- $list=array_slice(explode(" ",$e->text),1);
- switch ($e->command){
- case '.greet':
- if ((int)$u['level']>=module::$list['privmsg']['.greet']['level']) {
- if (isset($list[0])){
- $o->id=$u['id'];
- if ($u['level']<=1) $o->level=2;
- $o->pass=$list[0];
- user::update($o);
- }
- }
- break;
- case '.info':
- if ((int)$u['level']>=module::$list['privmsg']['.info']['level']) {
- if (isset($list[0])){
- $o->id=$u['id'];
- $o->info=implode(" ",$list);
- user::update($o);
- }
- }
- break;
- case '.update':
- if ((int)$u['level']>=module::$list['privmsg']['.update']['level']) {
- $o->nick=$list[0];
- $o->{$list[1]}=implode(" ",array_slice($list,2));
- user::update($o);
- }
- break;
- }
- }
- }
- public static function chanmsg ($e){
- $u=user::info($e);
- if (isset($u['level'])) {
- $list=array_slice(explode(" ",str_replace("me",$e->nick,$e->text)),1);
- $e->to=$list;
- switch ($e->command){
- case '.o':
- if ((int)$u['level']>=module::$list['chanmsg']['.o']['level']) {
- if(count($list)>0) irc::op($e); else irc::op($e);
- }else irc::chanmsg($e->sid,$e->chan,"sorry, but you need more power to do that.");
- break;
- case '.-o':
- if ((int)$u['level']>=module::$list['chanmsg']['.-o']['level']) {
- if(count($list)>0)irc::deop($e);else irc::deop($e);
- }else irc::chanmsg($e->sid,$e->chan,"sorry, but you need more power to do that.");
- break;
- case '.v':
- if ((int)$u['level']>=module::$list['chanmsg']['.v']['level']) {
- if(count($list)>0)irc::voice($e);else irc::voice($e);
- }else irc::chanmsg($e->sid,$e->chan,"sorry, but you need more power to do that.");
- break;
- case '.-v':
- if ((int)$u['level']>=module::$list['chanmsg']['.-v']['level']) {
- if(count($list)>0)irc::devoice($e);else irc::devoice($e);
- }else irc::chanmsg($e->sid,$e->chan,"sorry, but you need more power to do that.");
- break;
- case '.b':
- if ((int)$u['level']>=module::$list['chanmsg']['.b']['level']) {
- if(count($list)>0)irc::ban($list,$e->chan);else irc::chanmsg($e->chan,"empty list.");
- }else irc::chanmsg($e->sid,$e->chan,"sorry, but you need more power to do that.");
- break;
- case '.-b':
- if ((int)$u['level']>=module::$list['chanmsg']['.-b']['level']) {
- if(count($list)>0)irc::unban($list,$e->chan);else irc::chanmsg($e->chan,"empty list.");
- }else irc::chanmsg($e->sid,$e->chan,"sorry, but you need more power to do that.");
- break;
- case '.q':
- if ((int)$u['level']>=module::$list['chanmsg']['.q']['level']) {
- if(count($list)>0)irc::mute($list,$e->chan);else irc::chanmsg($e->chan,"empty list.");
- }else irc::chanmsg($e->sid,$e->chan,"sorry, but you need more power to do that.");
- break;
- case '.-q':
- if ((int)$u['level']>=module::$list['chanmsg']['.-q']['level']) {
- if(count($list)>0)irc::unmute($list,$e->chan);else irc::chanmsg($e->chan,"empty list.");
- }else irc::chanmsg($e->sid,$e->chan,"sorry, but you need more power to do that.");
- break;
- case '.t':
- if ((int)$u['level']>=module::$list['chanmsg']['.t']['level']) {
- $e->to=implode(" ",array_slice(explode(" ",$e->text),1));
- irc::topic($e);
- }else irc::chanmsg($e->sid,$e->chan,"sorry, but you need more power to do that.");
- break;
- case '.off':
- if ((int)$u['level']>=module::$list['chanmsg']['.off']['level']) {
- $e->text=implode(" ",array_slice(explode(" ",$e->text),1));
- irc::quit($e);
- }else irc::chanmsg($e->sid,$e->chan,"sorry, but you need more power to do that.");
- break;
- case '.r':
- if ((int)$u['level']>=module::$list['chanmsg']['.r']['level']) {
- $e->text=implode(" ",array_slice(explode(" ",$e->text),1));
- irc::restart($e);
- }else irc::chanmsg($e->sid,$e->chan,"sorry, but you need more power to do that.");
- break;
- case '.reload':
- if ((int)$u['level']>=module::$list['chanmsg']['.reload']['level']) {
- irc::reload();
- }else irc::chanmsg($e->sid,$e->chan,"sorry, but you need more power to do that.");
- break;
- case '.k':
- if ((int)$u['level']>=module::$list['chanmsg']['.k']['level']) {
- $list=explode(" ",$e->text);
- $reason=implode(" ",array_slice(explode(" ",$e->text),2));
- $e->reason=$reason;
- $e->to=$list[1];
- irc::kick($e);
- }else irc::chanmsg($e->sid,$e->chan,"sorry, but you need more power to do that.");
- break;
- case '.ul':
- if ((int)$u['level']>=module::$list['chanmsg']['.ul']['level']) {
- $out="";
- foreach (irc::$channels as $chan=>$ul){
- $out.=sprintf("%s:[",$chan);
- foreach($ul as $nick){$out.=sprintf("%s,",$nick);}
- $out=substr($out,0,-1)."]";
- }
- irc::chanmsg($e->sid,$e->chan,$out);
- }
- break;
- case '.help':
- $out="";
- $exp=explode(" ",$e->text);
- if (!isset($exp[1])) {
- $el=module::eventList();
- $out.=sprintf("event[%s]:[",'global');
- } else {
- $el=module::eventList($exp[1]);
- $out.=sprintf("event[%s]:[",$exp[1]);
- }
- if (count($el)>0){
- foreach($el as $key=>$list){
- if (!isset($exp[1])){
- $out.=sprintf("[%s]:[",$key);
- foreach($list as $subkey=>$info) {
- if ($u['level']>=$info['level'])$out.=sprintf("[%s]:level(%s),",$subkey,$info['level']);
- }
- $out=substr($out,0,-1);
- $out.="],";
- } elseif (isset($exp[1])&&!isset($exp[2])&&isset(module::$list[$exp[1]])) {
- $out.=sprintf("[%s]:level(%s),",$key,module::$list[$exp[1]][$key]['level']);
- } elseif (isset($exp[1])&&isset($exp[2])&&isset(module::$list[$exp[1]])&&isset(module::$list[$exp[1]][$exp[2]])) {
- $out=sprintf("[%s]:[%s",$exp[2],module::$list[$exp[1]][$exp[2]]['info']);
- } else $out=sprintf("[%s]:[no such command.",$exp[2]);
- }
- $out=substr($out,0,-1);
- $out.="]";
- irc::chanmsg($e->sid,$e->chan,$out);
- }
- break;
- }
- }
- }
- public static function init(){
- $o->type="chanmsg";
- $o->event->plugin="mod_operator";
- $o->event->func="chanmsg";
- $o->event->commandlist=
- array(
- array(".o",80,'gives op on channel.'),
- array(".-o",85,'takes user op on channel.'),
- array(".v",70,'gives user voice on channel.'),
- array(".-v",75,'takes user voice on channel'),
- array(".b",85,'bans user on channel'),
- array(".-b",70,'unbans user on channel'),
- array(".q",85,'mutes user on channel'),
- array(".-q",60,'unmutes user on channel'),
- array(".k",85,'kick user from channel'),
- array(".off",100,'halts the bot process'),
- array(".r",100,'restarts the bot.'),
- array(".reload",100,'reloads the system without killing the bot.'),
- array(".t",60,'changes channel topic'),
- array(".ul",95,'user list'),
- array(".help",1,'help!')
- );
- module::eventAdd($o);
- unset($o);
- $o->type="privmsg";
- $o->event->plugin="mod_operator";
- $o->event->func="privmsg";
- $o->event->commandlist=
- array(
- array('.greet',1,'greet the bot with your pass to gain more level!'),
- array('.info',2,'set your personal info'),
- array('.update',100,"lets the owner update the bot user's")
- );
- module::eventAdd($o);
- unset($o);
- $o->type="errornotop";
- $o->event->plugin="mod_operator";
- $o->event->func="errorNotOp";
- $o->event->command="errornotop";
- module::eventAdd($o);
- }
- }
- mod_operator::init();
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement