BeBot - An Anarchy Online and Age Of Conan chat automaton
Development => Module Requests => Topic started by: kinbaku on November 01, 2005, 09:09:30 pm
-
If you try to invite the bot to its own channel it results in a crash. ie if your bot is named bob, and u do !invite bob, the bot disconnects with this error in the console window:
Read error: EOF
[CONN] [ERROR] Bot has disconnected. Reconnecting in 60 seconds.
The bot is restarting.
Wondering if anybody could write a fix for me, i cant seem to fix it myself. Thanks.
PS - one would assume you could just NOT invite the bot to its own channel, but some friends of mine seem to find it funny to do so just to crash the bot. Thanks.
-
This is a theoretical fix.
Open modules/PrivGroup.php
Find function invite
Replace it with
function invite($from, $type, $who)
{
if (($this -> bot -> guildbot && $this -> bot -> is_member($from)) ||
$this -> bot -> admin -> in_group($from, "raidleader") ||
$this -> bot -> admin -> in_group($from, "admin") ||
$this -> bot -> admin -> in_group($from, "superadmin"))
{
if ($this -> bot -> botname == $who)
{
$msg = "You cannot invite the bot to its own chat group";
}
else if ($this -> bot -> aoc -> get_uid($who))
{
$this -> bot -> aoc -> privategroup_invite($who);
$this -> bot -> send_tell($who, "You have been invited to the privategroup by " . $from . ".");
$msg = "<font color=#ffff00>" . $who . "</font> has been invited.";
}
else
{
$msg = "Player <font color=#ffff00>" . $who . "</font> does not exist.";
}
}
else
$msg = "You do not have permission to use this command.";
if ($type == "tell")
$this -> bot -> send_tell($from, $msg);
else
$this -> bot -> send_pgroup($msg);
}
}
Untested, but should work.
-
Yep, works like a champ. :D
-
Works like a charm IF i suply the bot name all in lowercase letters "bot" However if I invite "Bot" or "bOt" or any other version it still crashes =/
-
Replace
if ($this -> bot -> botname == $who)
Withif ($this -> bot -> botname == strtolower($who))
-
Thanx, some days I shouldn't be allowed infront of the comp. Almost poked my eye when I saw that >.<