BeBot - An Anarchy Online and Age Of Conan chat automaton
Archive => Anarchy Online Archive => 0.2.x Custom/Unofficial Modules => Topic started by: Wanuarmi on December 03, 2005, 05:41:58 am
-
This is a pretty simple one that will show how many bot members are online
Save as MembersOnline.php in your modules folder, and use !membersonline on tells or raidchannel
<?
$membersOnline = new MembersOnline($bot);
$commands["tell"]["membersonline"] = &$membersOnline;
$commands["pgmsg"]["membersonline"] = &$membersOnline;
class MembersOnline
{
var $bot;
var $message;
function MembersOnline (&$bot)
{
$this -> bot = &$bot;
}
function tell($name, $msg)
{
$this -> bot -> send_tell($name, $this -> processCommand($name, $msg));
}
function pgmsg($name, $msg)
{
$this -> bot -> send_pgroup($this -> processCommand($name, $msg));
}
function processCommand($name, $msg)
{
if (preg_match("/^" . $this -> bot -> commpre . "membersonline$/i", $msg))
{
if ($this -> bot -> admin -> in_group($name, "leader") || $this -> bot -> admin -> in_group($name, "admin"))
{
$allonline = array_keys($this -> bot -> commands["tell"]["online"] -> guild);
$online = count($allonline);
return "There are <font color=#ffff00>$online</font> <botname> members online.";
}
}
}
}
?>
-
I don't think this work if you have over 1000 members, can someone confirm this?
-
There's a much easier way of showing the online members, and to show an actual list.
Get the members from the DB, 1 by 1, and as you get, check if they are online, (which doesn't exactly need to be saved in buddylist), add 1 to a counter, make an array if you want to show all members.
If you understand that, it theoretically should work :P I'll try to do up an online list today and post.
-
Silly question, but why not just use the online.php for this?
-
I made a !memberslist to show all members of the bot, along with if they were online.
That piece Wanuarmi posted is just repetition as it's already a module for the bot :p
-
what it does is show how many bot members are online, not on the chat
its mostly for raid bots, but it breaks after you have more than 1k members,
cause it counts the online people on the bots buddy list