BeBot - An Anarchy Online and Age Of Conan chat automaton
General => Feedback and Suggestions => Topic started by: Hotshot on September 05, 2006, 01:37:07 pm
-
Here is 2 of things i'd like to see put onto the bot.
!members (give list of members)
afk or brb (bot recognises these words and post little script "name" is afk)
-
Both implemented already.
search for !memberlist (by Wolfbiter) and !afk (by Craized). suggest to download v1.1 of !afk which is superior to the one distributed with Bebot (last time I looked). This will add an "AFK" next to the !online list.
Cheers,
-jj-
-
I can't promise my script will work with latest bebot, was a while since I wrote it and have no idea what possible database changes may have happend since.
-
I'll convert that one myself once I update to Bebot 0.3, it's bloody useful :-)
-jj-
-
Members list is planned for 0.3/0.5
Im not entirely happy with the AFK module for BeBot, and i actually find myself missing the AFK functionality from IGN. I don't know when i will find time to do something about it though.
-
Members list is planned for 0.3/0.5
Im not entirely happy with the AFK module for BeBot, and i actually find myself missing the AFK functionality from IGN. I don't know when i will find time to do something about it though.
From what I remember, mentioning someones name in chat that was afk spawned an afk message from the bot, which is what I miss. Is that what you mean? Not sure what else it did.
-
Yes, it's one of the things i miss.
Another thing was also that you didn't need to use a command prefix for the afk commands to be picked up.
-
The AFK module I run doesn't require a command prefix, it will do it with or without.
function gmsg($name, $group, $msg) {
if($name != ucfirst($this -> bot -> botname)) {
if(preg_match('/^'.$this -> bot -> commpre.'afk show$/i', $msg)) $c = $this -> list_afk();
elseif(preg_match('/^afk ?(.*)/i', $msg, $afkmsg)) $c = $this -> gone($name, $afkmsg[1]);
elseif(isset($this -> afk[$name])) $c = $this -> back($name);
$c != '' ? $this -> bot -> send_gc($c) : NULL;
}
}
-
The section I posted was just the gmsg section of the AFK module showing it listening for afk without a "!".
Here is the entire module:
<?php
/*
* AFK Module for BE Bot <http://bebot.fieses.net>
* Module coded by Craized <http://www.craized.net>
* v1.01
* Special thanks to Lal for bug fixes, styles, and development
/*
Add a '_' at the beginning of the file (_AFK.php) if you do not want it to be loaded.
*/
$afk = new AFK($bot);
$commands['tell']['afk'] = &$afk;
$commands['privgroup'][] = &$afk;
$commands['gmsg'][$guild_name][] = &$afk;
$commands["buddy"][] = &$afk;
Class AFK {
var $bot;
var $afk;
function AFK(&$bot) {
$this -> bot = &$bot;
$this -> afk = array();
$this -> bot -> db -> query('INSERT IGNORE INTO settings (setting, value) VALUES ("highlight_1", "CB11C9")');
$this -> highlight_1 = !method_exists($this -> bot, get_setting) ? '<font color=#CB11C9>' : '<font color=#'.$this -> bot -> get_setting('highlight_1').'>';
}
function buddy($name, $msg) {
if($msg != 1)
if($this -> afk[$name]) unset($this -> afk[$name]);
}
function tell($name, $msg) {
if(preg_match('/^'.$this -> bot -> commpre.'afk ?(.*)/i', $msg, $afkmsg)) $c = $this -> gone($name, $afkmsg[1]);
if(preg_match('/^'.$this -> bot -> commpre.'afk show$/i', $msg)) $c = $this -> list_afk();
$c != '' ? $this -> bot -> send_gc($c) : NULL;
}
function privgroup($name, $msg) {
if($name != ucfirst($this -> bot -> botname)) {
if(preg_match('/^'.$this -> bot -> commpre.'afk show$/i', $msg)) $c = $this -> list_afk();
elseif(preg_match('/^afk ?(.*)/i', $msg, $afkmsg)) $c = $this -> gone($name, $afkmsg[1]);
elseif(isset($this -> afk[$name])) $c = $this -> back($name);
$c != '' ? $this -> bot -> send_pgroup($c) : NULL;
}
}
function gmsg($name, $group, $msg) {
if($name != ucfirst($this -> bot -> botname)) {
if(preg_match('/^'.$this -> bot -> commpre.'afk show$/i', $msg)) $c = $this -> list_afk();
elseif(preg_match('/^afk ?(.*)/i', $msg, $afkmsg)) $c = $this -> gone($name, $afkmsg[1]);
elseif(isset($this -> afk[$name])) $c = $this -> back($name);
$c != '' ? $this -> bot -> send_gc($c) : NULL;
}
}
function gone($name, $msg) {
$this -> afk[$name] = empty($msg) ? 'Away from keyboard' : $msg;
$c = $this -> highlight_1.$name.'</font> is now AFK.';
return $c;
}
function back($name) {
if(isset($this -> afk[$name])) {
unset($this -> afk[$name]);
$c = $this -> highlight_1.$name.'</font> has returned from away.';
}
return $c;
}
function list_afk() {
$blob = '::::: '.$this -> bot -> guildname.(preg_match("#s$#i", $this -> bot -> guildname) ? '\'' : '\'s').' AFK List :::::';
$blob .= "\n\n\n";
foreach($this -> afk as $key=>$value) {
$blob .= $this -> highlight_1.$key.'</font> is AFK ('.$value.')';
$blob .= "\n\n";
}
$c = $this -> bot -> make_blob('User\'s AFK', $blob);
return $c;
}
}
?>