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

Title: Members Online
Post 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

Code: [Select]
<?
$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.";
}
}
}
}
?>
Title: Re: Members Online
Post by: Wanuarmi on December 11, 2005, 10:54:05 am
I don't think this work if you have over 1000 members, can someone confirm this?
Title: Re: Members Online
Post by: Naturalistic on December 11, 2005, 06:10:46 pm
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.
Title: Re: Members Online
Post by: Xenixa on December 11, 2005, 11:28:12 pm
Silly question, but why not just use the online.php for this?
Title: Re: Members Online
Post by: Naturalistic on December 12, 2005, 01:17:21 am
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
Title: Re: Members Online
Post by: Wanuarmi on December 12, 2005, 01:33:18 am
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
SimplePortal 2.3.7 © 2008-2025, SimplePortal