collapse collapse
* User Info
 
 
Welcome, Guest. Please login or register.
* Search

* Board Stats
  • stats Total Members: 989
  • stats Total Posts: 18366
  • stats Total Topics: 2501
  • stats Total Categories: 7
  • stats Total Boards: 35
  • stats Most Online: 1144

Author Topic: !guildrelay  (Read 8616 times)

0 Members and 4 Guests are viewing this topic.

Offline Naturalistic

  • Contributor
  • *******
  • Posts: 221
  • Karma: +0/-0
Re: !guildrelay
« Reply #15 on: April 07, 2006, 04:55:59 pm »
No, they don't have to be in the same irc channel. The relay works, you just need to make sure it's setup properly and that both boths are members on each others databases to use the !gcr function. (Might need a little fiddling with :P)
220/25 Eternalist Doctor
-----------------------------
Campalot Coding Co-ordinator and Super Admin
http://www.campalot.info/index.php

Offline Pharexys

  • BeBot Apprentice
  • ***
  • Posts: 117
  • Karma: +0/-0
Re: !guildrelay
« Reply #16 on: April 10, 2006, 04:00:25 pm »
I made it work sylf, if u need help gimme a tell ingame :P

Offline Pharexys

  • BeBot Apprentice
  • ***
  • Posts: 117
  • Karma: +0/-0
Re: !guildrelay
« Reply #17 on: May 14, 2006, 05:36:59 pm »
Would you mind posting the code that you modified please.
Here is a version that should work.
It's not the version I'm using, as that doesn't do any updating in the bots anymore, only the handling of the buddy list is left there, but it's a combination of the code I use.

Edit the $relay_bot variable to fit your needs, and add the org IDs in the $orgid array. Should work with as many orgs as you want, as long as the total number of combined members is below 1k. No guarantee for any kind of working over 1k.


O tryd this rooster, edited evrything.
But i get this error:

Code: [Select]
[2006-05-14 15:31:41]   [ROOSTER]       [UPDATE]        Starting rooster update

Fatal error: Call to a member function get_tablename() on a non-object in C:\bebot3.2\bebot\modules\Rooster_GUILD.php on line 85
Connected to MySQL
MySQL error (# 0) on query: ALTER TABLE admin_groups ADD description VARCHAR(80)
Duplicate column name 'description'
MySQL error (# 1) on query: ALTER TABLE admin_groups ADD short VARCHAR(5)
Duplicate column name 'short'

after this bot restart.
Anyone know what i wrong? What i am trying is to get 2 guilds on same !online list.
Edited Rooster a bit, but still get tons of errors, cant see what i wrong

edit: This is line 85 from rooster

Code: [Select]
// Clean old member list before repopulating:
$this -> bot -> db -> query("TRUNCATE TABLE " . $$this -> bot -> get_tablename("members"));
« Last Edit: May 14, 2006, 05:38:47 pm by Pharexys »

Offline Alreadythere

  • BeBot Maintainer
  • BeBot Hero
  • ******
  • Posts: 1288
  • Karma: +0/-0
Re: !guildrelay
« Reply #18 on: May 14, 2006, 05:44:27 pm »
Put the following code into Bot.php:
Code: [Select]
function get_tablename($table) { return $table; }
I'm using that function to use a bot-specific prefix for my tablenames.

Offline Pharexys

  • BeBot Apprentice
  • ***
  • Posts: 117
  • Karma: +0/-0
Re: !guildrelay
« Reply #19 on: May 14, 2006, 06:04:32 pm »
Put the following code into Bot.php:
Code: [Select]
function get_tablename($table) { return $table; }
I'm using that function to use a bot-specific prefix for my tablenames.

Already had it in bot.php coz im using ur modules,
:( dunno what the f*** it has.

Offline Khalem

  • BeBot Founder
  • Administrator
  • ********
  • Posts: 1169
  • Karma: +0/-0
    • http://www.ancarim.com
Re: !guildrelay
« Reply #20 on: May 14, 2006, 06:41:52 pm »
Wild guess
Code: [Select]
// Clean old member list before repopulating:
$this -> bot -> db -> query("TRUNCATE TABLE " . $$this -> bot -> get_tablename("members"));

Should probably be:
Code: [Select]
// Clean old member list before repopulating:
$this -> bot -> db -> query("TRUNCATE TABLE " . $this -> bot -> get_tablename("members"));
BeBot Founder and Fixer Kingpin

Offline Pharexys

  • BeBot Apprentice
  • ***
  • Posts: 117
  • Karma: +0/-0
Re: !guildrelay
« Reply #21 on: May 14, 2006, 07:10:09 pm »
Wild guess
Code: [Select]
// Clean old member list before repopulating:
$this -> bot -> db -> query("TRUNCATE TABLE " . $$this -> bot -> get_tablename("members"));

Should probably be:
Code: [Select]
// Clean old member list before repopulating:
$this -> bot -> db -> query("TRUNCATE TABLE " . $this -> bot -> get_tablename("members"));

i tryd this before but tryd it again, and i get this:

Code: [Select]
[2006-05-14 17:01:15]   [ROOSTER]       [UPDATE]        Starting rooster update
MySQL error (# 0) on query: INSERT INTO  (id, nickname, firstname, lastname, rank, rank_name, level, profession, gender, breed, ai_rank_id, ai_rank, p
ic, lvlrange) VALUES ('749693768', 'Pharexys', '', '', '0', 'President', '220', 'Adventurer', 'Male', 'Solitus', '22',  'Challenger', 'http://www.anar
chy-online.com/character/photos/40705.jpg', '215-220')

You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '(id, nickname,
firstname, lastname, rank, rank_name, level, profession, gender, ' at line 1
Threshold of 10 errors in 30 seconds reached. Supressing error output for 30 seconds

Warning: Invalid argument supplied for foreach() in C:\bebot3.2\1\bebot\modules\Rooster_GUILD.php on line 139
[2006-05-14 17:01:32]   [ROOSTER]       [UPDATE]        Rooster update complete. Added 0 members, removed 0.
[2006-05-14 17:01:32]   [GROUP] [MSG]   [Devil Inside] Devilbot1: Bot is online :: System Ready


Line 139 from Rooster looks like this:
Code: [Select]
foreach ($memberlist as $currentmember)
wich is good imo, nothing wrong... well dunno what it has, i tryd to run it on a blank database, same stuff.
Probly someone already has 2 guilds that sharing the !online(member list) ?

Offline Khalem

  • BeBot Founder
  • Administrator
  • ********
  • Posts: 1169
  • Karma: +0/-0
    • http://www.ancarim.com
Re: !guildrelay
« Reply #22 on: May 14, 2006, 08:26:05 pm »
Looks like your Roster module is missing parts of a modification done to it in regards to table names.
Fixing the error i pointed out should be done, it has merely revealed another problem with the module.
BeBot Founder and Fixer Kingpin

Offline Alreadythere

  • BeBot Maintainer
  • BeBot Hero
  • ******
  • Posts: 1288
  • Karma: +0/-0
Re: !guildrelay
« Reply #23 on: May 14, 2006, 09:47:35 pm »
Make sure that the colums that are used in the insert command exist in the members table, otherwise you can remove unused columns.

Offline Pharexys

  • BeBot Apprentice
  • ***
  • Posts: 117
  • Karma: +0/-0
Re: !guildrelay
« Reply #24 on: May 15, 2006, 12:52:58 am »
Ok I couldnt edit ur Rooster Already, im not a coder or hacker or anything, atleast on php.
So i made 2 Roosters, redefineted em, also removed the function to rem buddys, and i run em 1 by 1,
I think i will make a script to run em evry 2 days or something, i know its not the "clean solve" but atleast works for me...
anyway i would still like to get 1 rooster for 2 guilds done, but till i got some time to spend on it, i'll work my way out with 2 roosters for my guilds.
If anyone want help on how to do it, I can even post the code here. Just ask i'll probly check this forums evry day since im workin on a raidbot now.

Offline Pharexys

  • BeBot Apprentice
  • ***
  • Posts: 117
  • Karma: +0/-0
Re: !guildrelay
« Reply #25 on: May 21, 2006, 02:30:02 am »
Code: [Select]
<?php
  
/*
   * Rooster.php - Handle member rooster
   *
   * BeBot - An Anarchy Online Chat Automaton
   * Copyright (C) 2004 Jonas Jax
   *
   * Developed by Blondengy (RK1)
   * Special thanks goes out to Khalem (RK1) for his support.
   *
   * File last changed at $LastChangedDate: 2004-12-29 01:41:32 +0100 (Wed, 29 Dec 2004) $
   * Revision: $Id: Rooster_GUILD.php 8 2004-12-29 00:41:32Z blondengy $
   *
   * Updated by Xenixa (RK1) to Include Alien Rank and Level.
   */


  /*
   Prepare MySQL database
  */
  
$db -> query("CREATE TABLE IF NOT EXISTS " $bot -> get_tablename("members") . "
              (id INT NOT NULL PRIMARY KEY,
              nickname VARCHAR(25),
              firstname VARCHAR(25),
              lastname VARCHAR(25),
              rank TINYINT,
              rank_name VARCHAR(20),
              level INT,
              profession VARCHAR(15),
              gender VARCHAR(10),
              breed VARCHAR(10),
              ai_rank_id INT,
              ai_rank VARCHAR(15),
              pic VARCHAR(100),
              lvlrange VARCHAR(10))"
);

  
$rooster = new Rooster($bot);

$commands["tell"]["member"] = &$rooster;
$commands["tell"]["members"] = &$rooster;
$commands["tell"]["memberlist"] = &$rooster;
$commands["gc"]["member"] = &$rooster;
$commands["gc"]["members"] = &$rooster;
$commands["gc"]["memberlist"] = &$rooster;
$commands["pgmsg"]["member"] = &$rooster;
$commands["pgmsg"]["members"] = &$rooster;
$commands["pgmsg"]["memberlist"] = &$rooster;


  
$cron["12hour"][] = &$rooster;



  
/*
    The Class itself...
  */
  
class Rooster
  
{
    var 
$bot;

    function 
Rooster (&$bot)
    {
$this -> bot = &$bot;
    }



    
/*
      This gets called on cron
    */
    
function cron()
    {
$this -> bot -> log("ROOSTER""UPDATE""Starting rooster update");

// Modify to fit your needs:
$relay_bot $this -> bot -> get_setting("relaybot");

// List of org ids this bot should keep as members:
// EDIT THOSE TO FIT YOUR NEED!
$orgids[0] = 01;
$orgids[1] = 02;

// Clean old member list before repopulating:
$this -> bot -> db -> query("TRUNCATE TABLE " $this -> bot -> get_tablename("members"));


foreach ($orgids as $orgid)
{
$org $this -> bot -> get_site("http://community.anarchy-online.com/org/stats/d/" $this -> bot -> dimension "/name/" $orgid "/basicstats.xml");
$org explode("<member>"$org);

// Parse members
for ($i 1$i count($org); $i++)
{
$memb["nickname"] = $this -> bot -> xmlparse($org[$i], "nickname");
$memb["firstname"] = $this -> bot -> xmlparse($org[$i], "firstname");
$memb["lastname"] = $this -> bot -> xmlparse($org[$i], "lastname");
$memb["rank"] = $this -> bot -> xmlparse($org[$i], "rank");
$memb["rank_name"] = $this -> bot -> xmlparse($org[$i], "rank_name");
$memb["level"] = $this -> bot -> xmlparse($org[$i], "level");
$memb["profession"] = $this -> bot -> xmlparse($org[$i], "profession");
$memb["gender"] = $this -> bot -> xmlparse($org[$i], "gender");
$memb["breed"] = $this -> bot -> xmlparse($org[$i], "breed");
$memb["ai_rank_id"] = $this -> bot -> xmlparse($org[$i], "defender_rank_id");
$memb["ai_rank"] = $this -> bot -> xmlparse($org[$i], "defender_rank");
$memb["pic"] = $this -> bot -> xmlparse($org[$i], "photo_url");
$memb["id"] = $this -> bot -> aoc -> get_uid($memb["nickname"]);

if (($memb["level"] >= 1) && ($memb["level"] <= 99))
$memb["lvlrange"] = "1-99";
else if (($memb["level"] >= 100) && ($memb["level"] <= 149))
$memb["lvlrange"] = "100-149";
else if (($memb["level"] >= 150) && ($memb["level"] <= 199))
$memb["lvlrange"] = "150-199";
else if (($memb["level"] >= 200) && ($memb["level"] <= 214))
$memb["lvlrange"] = "200-214";
else if (($memb["level"] >= 215) && ($memb["level"] <= 220))
$memb["lvlrange"] = "215-220";
else
$memb["lvlrange"] = "unknown";

$this -> bot -> db -> query("INSERT INTO members (id, nickname, firstname,"
" lastname, rank, rank_name, level, profession, gender, breed, ai_rank_id, ai_rank, pic, lvlrange)"
" VALUES ('" $memb["id"] . "', '" $memb["nickname"] . "', '" $memb["firstname"] . "', '"
$memb["lastname"] . "', '" $memb["rank"] . "', '" $memb["rank_name"] . "', '" $memb["level"]
"', '" $memb["profession"] . "', '" $memb["gender"] . "', '" $memb["breed"] . "', '"
$memb["ai_rank_id"] . "',  '" $memb["ai_rank"] . "', '" $memb["pic"] . "', '" $memb["lvlrange"]
"')");
}
}

// get memberslist, and add all buddies in there:
$memberlist $this -> bot -> db -> select("SELECT * FROM " $this -> bot -> get_tablename("members"));

$buds $this -> bot -> aoc -> buddies;
$added 0;
$removed 0;

foreach ($memberlist as $currentmember)
{
$nickname $currentmember[1];
$id $currentmember[0];

if (ucfirst(strtolower($nickname)) != ucfirst(strtolower($this -> bot -> botname))
&& ucfirst(strtolower($nickname)) != ucfirst(strtolower($relay_bot)))
{
if (!$this -> bot -> aoc -> buddy_exists($id))
{
$this -> bot -> aoc -> buddy_add($id);
$this -> bot -> log("BUDDY""ADD"$this -> bot -> aoc -> get_uname($id));
$added++;
}
unset($buds[$id]);
}
}

        
$removed count($buds);

        
// Remove buddys not on list...
        
foreach ($buds as $id => $value)
        {
          
$this -> bot -> aoc -> buddy_remove($id);
          
$this -> bot -> log("BUDDY""DEL"$this -> bot -> aoc -> get_uname($id));
        }

$this -> bot -> log("ROOSTER""UPDATE""Rooster update complete. Added $added members, removed $removed.");
    }


/*
This gets called on a tell with the command
*/
function tell($name$msg)
{
if ($this -> bot -> admin -> in_group($name"admin"))
{
if (preg_match("/^" $this -> bot -> commpre "member del (.+)$/i"$msg$info))
$this -> bot -> send_tell($name$this -> member_del($name$info[1]));
else if (preg_match("/^" $this -> bot -> commpre "members$/i"$msg)
|| preg_match("/^" $this -> bot -> commpre "memberlist$/i"$msg))
$this -> bot -> send_tell($name$this -> member_list());
else if (preg_match("/^" $this -> bot -> commpre "member (.+)$/i"$msg$info))
$this -> bot -> send_tell($name$this -> member_add($name$info[1]));
}
else
$this -> bot -> send_tell($name"You must be an admin of this bot to use this command.");
}


/*
      This gets called on a msg in the guild chat with the command
    */
function gc($name$msg)
{
if ($this -> bot -> admin -> in_group($name"admin"))
{
if (preg_match("/^" $this -> bot -> commpre "member del (.+)$/i"$msg$info))
{
$this -> bot -> send_gc($this -> member_del($name$info[1]));
}
else if (preg_match("/^" $this -> bot -> commpre "notify on (.+)$/i"$msg$info))
$this -> notify_on($info[1]);
else if (preg_match("/^" $this -> bot -> commpre "notify off (.+)$/i"$msg$info))
$this -> notify_off($info[1]);
else if (preg_match("/^" $this -> bot -> commpre "members$/i"$msg)
|| preg_match("/^" $this -> bot -> commpre "memberlist$/i"$msg))
{
$this -> bot -> send_gc($this -> member_list());
}
else if (preg_match("/^" $this -> bot -> commpre "member (.+)$/i"$msg$info))
{
$this -> bot -> send_gc($this -> member_add($name$info[1]));
}
}
else
$this -> bot -> send_tell($name"You must be an admin of this bot to use this command.");
}

function pgmsg($name$msg)
{
if ($this -> bot -> admin -> in_group($name"admin"))
{
if (preg_match("/^" $this -> bot -> commpre "member del (.+)$/i"$msg$info))
{
$this -> bot -> send_pgroup($this -> member_del($name$info[1]));
}
else if (preg_match("/^" $this -> bot -> commpre "members$/i"$msg)
|| preg_match("/^" $this -> bot -> commpre "memberlist$/i"$msg))
{
$this -> bot -> send_pgroup($this -> member_list());
}
else if (preg_match("/^" $this -> bot -> commpre "member (.+)$/i"$msg$info))
{
$this -> bot -> send_pgroup($this -> member_add($name$info[1]));
}
}
else
$this -> bot -> send_tell($name"You must be an admin of this bot to use this command.");

}

function member_add($name$info)
{
$result $this -> bot -> db -> select("SELECT nickname FROM " $this -> bot -> get_tablename("members") . " WHERE id = "
$this -> bot -> aoc -> get_uid($info));

if (empty($result))
{
if (!$this -> bot -> aoc -> get_uid($info))
return "Player <font color=#FFFF00>" $info "</font> does not exist";
else
{
$member $this -> bot -> get_site("http://www.anarchy-online.com/character/bio/d/"
$this -> bot -> dimension "/name/" strtolower($info) . "/bio.xml");
$members["nickname"] = ucfirst(strtolower($info));
$members["firstname"] = $this -> bot -> xmlparse($member"firstname");
$members["lastname"] = $this -> bot -> xmlparse($member"lastname");
$members["rank"] = $this -> bot -> xmlparse($member"rank_id");
$members["rank_name"] = $this -> bot -> xmlparse($member"rank");
$members["level"] = $this -> bot -> xmlparse($member"level");
$members["profession"] = $this -> bot -> xmlparse($member"profession");
$members["gender"] = $this -> bot -> xmlparse($member"gender");
$members["ai_rank_id"] = $this -> bot -> xmlparse($member"defender_rank_id");
$members["ai_rank"] = $this -> bot -> xmlparse($member"defender_rank");
$members["breed"] = $this -> bot -> xmlparse($member"breed");
$members["pic"] = $this -> bot -> xmlparse($member"smallphoto_url");
$members["id"] = $this -> bot -> aoc -> get_uid($members["nickname"]);

if (($members["level"] >= 1) && ($members["level"] <= 99))
$members["lvlrange"] = "1-99";
else if (($members["level"] >= 100) && ($members["level"] <= 149))
$members["lvlrange"] = "100-149";
else if (($members["level"] >= 150) && ($members["level"] <= 199))
$members["lvlrange"] = "150-199";
else if (($members["level"] >= 200) && ($members["level"] <= 214))
$members["lvlrange"] = "200-214";
else if (($members["level"] >= 215) && ($members["level"] <= 220))
$members["lvlrange"] = "215-220";
else
$members["lvlrange"] = "unknown";

$this -> bot -> db -> query("INSERT INTO " $this -> bot -> get_tablename("members")
" (id, nickname, firstname, lastname, rank, rank_name, level, profession, gender, breed,"
" ai_rank_id, ai_rank, pic, lvlrange)
VALUES ('" 
$members["id"] . "',
'" 
$members["nickname"] . "', '" $members["firstname"] . "',
'" 
$members["lastname"] . "', '" $members["rank"] . "',
'" 
$members["rank_name"] . "', '" $members["level"] . "',
'" 
$members["profession"] . "', '" $members["gender"] . "',
'" 
$members["breed"] . "', '" $members["ai_rank_id"] . "',
'" 
$members["ai_rank"] . "', '" $members["pic"] . "',
'" 
$members["lvlrange"] . "')");

$this -> bot -> send_tell($info"<font color=#FFFF00>" $name "</font> has added you to <botname>'s roster.");
return "Player <font color=#FFFF00>" $info "</font> has been added to <botname>'s roster.";
}
}
else
return "<font color=#FFFF00>" $result[0][0] . "</font> is already on <botname>'s roster.";
}

function member_del($name$info)
{
$result $this -> bot -> db -> select("SELECT nickname FROM " $this -> bot -> get_tablename("members") . " WHERE id = "
$this -> bot -> aoc -> get_uid($info));
if (!empty($result))
{
$id $this -> bot -> aoc -> get_uid($info);
$this -> bot -> db -> query("DELETE FROM " $this -> bot -> get_tablename("members") . " WHERE id = " $id);
$this -> bot -> aoc -> buddy_remove($id);
return "<font color=#FFFF00>" $info "</font> has been removed from <botname>'s roster.";
}
else
return "<font color=#FFFF00>" $info "</font> is not on <botname>'s roster.";
}

function member_list()
{
$result $this -> bot -> db -> select("SELECT nickname FROM " $this -> bot -> get_tablename("members")
" ORDER BY nickname ASC");
$str $this -> bot -> colors -> get("white") . "Members of this bot:<br>"
$this -> bot -> colors -> get("lightgrey");;
$i 0;
foreach ($result as $mem)
{
$i++;
$str .= $mem[0] . "<br>";
}
return $this -> bot -> make_blob($this -> bot -> botname " has " $i " members!"$str);
}
}
?>



I made it work, you only need to edit org ids, and it should work now :P
« Last Edit: June 05, 2006, 07:40:13 pm by Khalem »

Offline Sylfarin

  • BeBot Rookie
  • *
  • Posts: 10
  • Karma: +0/-0
Re: !guildrelay
« Reply #26 on: June 06, 2006, 03:22:03 pm »
First of all thanks for sharing this Phare, works like a charm.

I have a couple questions still though regarding the online function, where should I look in order to have the !online function to not display the bots themselves - it currently does as I am logged on chat server having a few tests.
Other problem I have with this is that when one logs on he gets tells from both bots displaying the number of online players.

Not that it's too big of a problem but that's a bit useless.  ;)

Anyways, thanks again for sharing this.
« Last Edit: June 06, 2006, 03:45:19 pm by Sylfarin »

Offline Pharexys

  • BeBot Apprentice
  • ***
  • Posts: 117
  • Karma: +0/-0
Re: !guildrelay
« Reply #27 on: June 06, 2006, 04:41:39 pm »
Dunno how to remove em from member table,
Hm do you mean both bots says xxx logged on?
or they tell you how many members are online? kinda confused me here :P


If it show twice the player logon, simple put a _ infront of Logon_Guild.
(ps. do it on twink org, wont be able to set up !logon ;p)

Offline Sylfarin

  • BeBot Rookie
  • *
  • Posts: 10
  • Karma: +0/-0
Re: !guildrelay
« Reply #28 on: June 06, 2006, 04:43:50 pm »
My bad I got the login issue fixed, was the LogonNotify_GUILD.php file which I had to edit somewhat to fit my needs.

Still trying to figure out how to remove the bots from the online list without getting me into too much trouble.

Offline Alreadythere

  • BeBot Maintainer
  • BeBot Hero
  • ******
  • Posts: 1288
  • Karma: +0/-0
Re: !guildrelay
« Reply #29 on: June 06, 2006, 04:48:38 pm »
Tried setting $relay_bot to the name of the second org bot?
That variable is supposed to fix your problem.

 

* Recent Posts
Com bot module by bitnykk
[November 25, 2024, 05:36:11 pm ]


0.8.x updates for AO by bitnykk
[June 23, 2024, 03:19:47 pm ]


0.8.x updates for AoC by bitnykk
[June 23, 2024, 03:19:44 pm ]


[AoC] special char for items module by bitnykk
[February 09, 2024, 09:41:18 pm ]


BeBot still alive & kicking ! by bitnykk
[December 17, 2023, 12:58:44 am ]

* Who's Online
  • Dot Guests: 120
  • Dot Hidden: 0
  • Dot Users: 0

There aren't any users online.
* Forum Staff
bitnykk admin bitnykk
Administrator
Khalem admin Khalem
Administrator
WeZoN gmod WeZoN
Global Moderator
SimplePortal 2.3.7 © 2008-2024, SimplePortal