BeBot - An Anarchy Online and Age Of Conan chat automaton

Development => Module Requests => Topic started by: Shelnaria on December 05, 2005, 04:23:56 am

Title: A memberlist
Post by: Shelnaria on December 05, 2005, 04:23:56 am
I have and use the !memberlist which shows the amount of people on the bot but would truly like to see a module that has a listing similiar to !online that shows all the org members. Perhaps keep it to member or admin only usage to prevent severe slowdowns on the bot. It only seems logical that the bot can do this as it can tell who is online and also has a record for the org for who is and is not a member in the sql tables. I am still learning php so its a bit beyond me to tackle at this time.
Title: Re: A memberlist
Post by: Handor on December 15, 2005, 02:07:47 am
  Hello,
 I would like to see a !members command module for Bebot aswell, similar to IGN's. Just a list of org members, and their lvls. IF some one could make this it would be extremely appreciated in the AO community.

Thank You.
Title: Re: A memberlist
Post by: Wolfbiter on January 20, 2006, 10:58:20 am
This one only works in tells, formatting is so so.. I don't really use it myself anymore.
Code: [Select]
<?
  /*
   * Something written by wolfbiter
   */
   
  $ml = new memberList($bot);

  $commands["tell"]["memberlist"] = &$ml;

  class memberList {
    var $bot;
    var $online;
    function memberList (&$bot) {$this->bot = &$bot;}
    function tell($name, $msg) {
        $admin = $this->bot->admin->in_group($name, "admin");
        $leader = $this->bot->admin->in_group($name, "raidleader");
        if ($admin || $leader) {$this -> bot -> send_tell($name, $this -> list_members($name,$msg));}
    }
    function list_members($name,$msg) {
        unset($admins,$leaders,$members);
        $text = explode(" ",$msg);
        if ($text[1] == "org" || $text[1] == "guild") {$sql="select nickname,profession,level,guild from members order by 'guild','nickname','profession','level' asc";}
        elseif ($text[1] == "prof" || $text[1] == "profession") { $sql="select nickname,profession,level,guild from members order by 'profession','nickname','level','guild' asc";}
        elseif ($text[1] == "level") {$sql="select nickname,profession,level,guild from members order by 'level','profession','nickname','guild' ASC";}
        else {$sql="select nickname,profession,level,guild from members order by 'nickname','profession','level','guild' asc";}
        $rawlist = $this->bot->db->select($sql);
        $memberstot = count($rawlist);
        foreach ($rawlist as $member) {
            $name = $member[0];
            $namelist[$name]['level'] = $member[2];
            $namelist[$name]['org'] = $member[3];
            $namelist[$name]['prof'] = $member[1];
            $admin = $this->bot->admin->in_group($name, "admin");
            $leader = $this->bot->admin->in_group($name, "raidleader");
            if ($admin) {$admins[] = $name;}
            elseif ($leader) {$leaders[] = $name;}
            else {$members[] = $name;}
        }
$output= "<font color=#FFFF66>Order by [ <a href='chatcmd:///tell <botname> !memberlist'>Name</a> ] [ <a href='chatcmd:///tell <botname> !memberlist level'>Level</a> ] [ <a href='chatcmd:///tell <botname> !memberlist prof'>Profession</a> ] [ <a href='chatcmd:///tell <botname> !memberlist org'>Org</a> ]<br><br>";
    if (count($admins) > 0) {
        $output.='<font color=#99CCCC>[<u>Admins</u>]';
    foreach($admins as $cur) {$output.='<br><font color=#FFFFFF> '.$cur." - <font color=#009900>".$namelist[$cur]['level']." <font color=#CC0000>".$namelist[$cur]['prof']."<font color=#66CCCC> (".$namelist[$cur]['org'].")";}
}
if (count($leaders) > 0) {
        $output.='<br><br><font color=#99CCCC>[<u>Leaders</u>]';
    foreach($leaders as $cur) {$output.='<br><font color=#FFFFFF> '.$cur." - <font color=#009900>".$namelist[$cur]['level']." <font color=#CC0000>".$namelist[$cur]['prof']."<font color=#66CCCC> (".$namelist[$cur]['org'].")";}
}
if (count($members) > 0) {
        $output.='<br><br><font color=#99CCCC>[<u>Members</u>]';
    foreach($members as $cur) {$output.='<br><font color=#FFFFFF> '.$cur." - <font color=#009900>".$namelist[$cur]['level']." <font color=#CC0000>".$namelist[$cur]['prof']."<font color=#66CCCC> (".$namelist[$cur]['org'].")";}
}
$return = $this->bot->make_blob($memberstot." Members",$output);
return $return;
    }
  }
?>
Title: Re: A memberlist
Post by: Shelnaria on February 11, 2006, 04:36:05 am
It looks good but when I try to use this I am getting Warning: Invalid argument supplied for foreach() in C:\Bebot\modules\memberlist.
php on line 28

Any advice?

Title: Re: A memberlist
Post by: Wolfbiter on February 11, 2006, 05:53:11 am
When I wrote it, I assumed the query would never be empty, so there's no check for that.
the whole foreach{} must have "if (!empty($rawlist)) {}" around it.

I'd like to point out that this script was made for raidbot, not orgbot.

Code for orgbot is below
Code: [Select]
<?
  /*
   * Something written by wolfbiter
   */
   
  $ml = new memberList($bot);

  $commands["tell"]["memberlist"] = &$ml;

  class memberList {
    var $bot;
    var $online;
    function memberList (&$bot) {$this->bot = &$bot;}
    function tell($name,$msg) {$this->bot->send_tell($name,$this->list_members($name,$msg));}
    function list_members($name,$msg) {
        unset($admins,$leaders,$members);
        $text = explode(" ",$msg);
        if ($text[1] == "prof" || $text[1] == "profession") { $sql="select nickname,profession,level from members order by 'profession','nickname','level' asc";}
        elseif ($text[1] == "level") {$sql="select nickname,profession,level from members order by 'level','profession','nickname' ASC";}
        else {$sql="select nickname,profession,level from members order by 'nickname','profession','level' asc";}
        $rawlist = $this->bot->db->select($sql);
        $memberstot = count($rawlist);
        foreach ($rawlist as $member) {
            $name = $member[0];
            $namelist[$name]['level'] = $member[2];
            $namelist[$name]['prof'] = $member[1];
            $admin = $this->bot->admin->in_group($name, "admin");
            $leader = $this->bot->admin->in_group($name, "raidleader");
            if ($admin) {$admins[] = $name;}
            elseif ($leader) {$leaders[] = $name;}
            else {$members[] = $name;}
        }
$output= "<font color=#FFFF66>Order by [ <a href='chatcmd:///tell <botname> !memberlist'>Name</a> ] [ <a href='chatcmd:///tell <botname> !memberlist level'>Level</a> ] [ <a href='chatcmd:///tell <botname> !memberlist prof'>Profession</a> ]<br><br>";
    if (count($admins) > 0) {
        $output.='<font color=#99CCCC>[<u>Admins</u>]';
    foreach($admins as $cur) {$output.='<br><font color=#FFFFFF> '.$cur." - <font color=#009900>".$namelist[$cur]['level']." <font color=#CC0000>".$namelist[$cur]['prof']."<font color=#66CCCC>";}
}
if (count($leaders) > 0) {
        $output.='<br><br><font color=#99CCCC>[<u>Leaders</u>]';
    foreach($leaders as $cur) {$output.='<br><font color=#FFFFFF> '.$cur." - <font color=#009900>".$namelist[$cur]['level']." <font color=#CC0000>".$namelist[$cur]['prof']."<font color=#66CCCC>";}
}
if (count($members) > 0) {
        $output.='<br><br><font color=#99CCCC>[<u>Members</u>]';
    foreach($members as $cur) {$output.='<br><font color=#FFFFFF> '.$cur." - <font color=#009900>".$namelist[$cur]['level']." <font color=#CC0000>".$namelist[$cur]['prof']."<font color=#66CCCC>";}
}
$return = $this->bot->make_blob($memberstot." Members",$output);
return $return;
    }
  }
?>
Title: Re: A memberlist
Post by: stonybg on February 24, 2006, 11:07:37 am
Wolfbiter can you add function to show in same blob with members lis who its online and who its not ?
bebot its instal for orgbot but have addet many members from other bots and will be greed if can see how much members its online (all with this one neot joinet in chanel) and how its online and who not.
tanky
Title: Re: A memberlist
Post by: Wolfbiter on February 24, 2006, 04:24:29 pm
It's not meant to be used for online, it's so you can check the users on the bot. There's an !online command, use that instead.
Title: Re: A memberlist
Post by: stonybg on March 15, 2006, 04:30:50 pm
!online comad show me only online player in bot not how much members total its online, example i wana strart raid but dont know how much total members its online in bot and for that need start raid, to see how much will join in bot  and if dont have minimum come...
Title: Re: A memberlist
Post by: Naturalistic on March 15, 2006, 05:09:40 pm
You need to basically code that in. Here's just an idea (and don't copy/paste, because you need to do some work to get the whole thing working :P)

$buddylist = $this->bot->aoc->buddies;
foreach ($buddylist as $id => $crap)
{
  if ($this->bot->aoc->buddy_online($id))
  {
    $this -> useronline[$id]= $id;
  }
}...

Then just display $this -> useronline[$id]

This will only work properly if the buddylist is less than 1000 remember.
Title: Re: A memberlist
Post by: MatHack on March 15, 2006, 05:13:52 pm
Assuming this is a raidbot, you gotta adjust core/Online.php and add some command that will return:

count($this -> pgroup)

That would give you the number of people in your privategroup.
Title: Re: A memberlist
Post by: Naturalistic on March 15, 2006, 05:15:13 pm
Unless I read that wrong.

Figured he wanted 'who' was online.

Same code can apply, $this -> useronline[$id]= $id; just replace with $buddycount++;
Title: Re: A memberlist
Post by: jjones666 on June 22, 2006, 06:14:52 pm
http://www.jjones.co.uk/files/memberlist.php

Needed a good way to clean up the roster on the org, so added a few things to Wolfbiter's script - org rank (to see who needed promoting), last seen time (to see who needed kicking) and a button to retrieve the toon's alts (no make sure all alts were registered to main).

N.B. Obviously, u need Xen's excellent rooster_guild for the last seen time to work (and I also use his modified !alts commands).

One small problem, the last person in list doesn't seem to process the lastseen time properly, if anyone knows how to fix that, I would be grateful =)

Cheers,

-jj-
Title: Re: A memberlist
Post by: jjones666 on January 14, 2007, 03:01:22 pm
Updated above, sorts properly now.

-jj-
Title: Re: A memberlist
Post by: Zweiblum on August 14, 2008, 12:24:40 pm
anyway to get this for bebot 0.5.2 ?

and a !adminlist maybe thats just lists admins and leader of the bot
SimplePortal 2.3.7 © 2008-2025, SimplePortal