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

Title: problem with invite command, need fix
Post 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.
Title: problem with invite command, need fix
Post by: Khalem on November 03, 2005, 12:52:35 am
This is a theoretical fix.

Open modules/PrivGroup.php
Find function invite
Replace it with
Code: [Select]

    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.
Title: problem with invite command, need fix
Post by: Xenixa on November 07, 2005, 05:03:07 pm
Yep, works like a champ.  :D
Title: problem with invite command, need fix
Post by: Solerna on November 10, 2005, 11:23:29 pm
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 =/
Title: problem with invite command, need fix
Post by: Xenixa on November 10, 2005, 11:33:17 pm
Replace
Code: [Select]
if ($this -> bot -> botname == $who)
With
Code: [Select]
if ($this -> bot -> botname == strtolower($who))
Title: problem with invite command, need fix
Post by: Solerna on November 11, 2005, 12:12:46 am
Thanx, some days I shouldn't be allowed infront of the comp. Almost poked my eye when I saw that >.<
SimplePortal 2.3.7 © 2008-2024, SimplePortal