BeBot - An Anarchy Online and Age Of Conan chat automaton

Archive => Anarchy Online Archive => 0.2.x Custom/Unofficial Modules => Topic started by: Snarfblatt on August 28, 2006, 06:24:21 pm

Title: Updated Autoinv.php to allow for per user inviting
Post by: Snarfblatt on August 28, 2006, 06:24:21 pm
A few of my members requested the ability to turn on/off auto-inviting on an individual basis. So I added a "auto_invite" field to the members table and changed the following methods in Autoinv.php:

Code: [Select]
/*
Toggles autoinvite on/off
*/
function switchauto($name, $toggle)
{
if ($this -> bot -> admin -> in_group($name, "superadmin"))
{
$this -> bot -> db -> query("DELETE FROM settings WHERE setting = 'auto_invite'");
$toggle == strtolower($toggle);
$new = (($toggle == "on") ? 1 : 0);
$this -> bot -> db -> query("INSERT INTO settings (setting, value) VALUES ('auto_invite', $new)");

$this -> auto = $new;

return "Auto inviting has been <font color=#ffff00>" .
(($new == 1) ? "enabled" : "disabled") . "</font>.";
}
else
{
$new = (($toggle == "on") ? 1 : 0);
$this-> bot -> db -> query ("UPDATE members SET auto_invite = $new");

return "Auto inviting has been <font color=#ffff00>" .
(($new == 1) ? "enabled" : "disabled") . " for " . $name . "</font>.";
}
}



/*
This gets called if a buddy logs on/off
*/
function buddy($name, $msg)
{
$invite = 0;

$result = $this -> bot -> db -> select("SELECT auto_invite FROM members WHERE nickname = '$name'");
if (empty($result))
$invite = 0;
else
$invite = $result[0][0];

if (($invite == 1) && ($this -> auto == 1) && ($msg == 1) && ($this -> bot -> is_member($name) == 1))
$this -> bot -> aoc -> privategroup_invite($name);
}

Don't know if this is helpful to anyone, but I thought I would post it here.
Title: Re: Updated Autoinv.php to allow for per user inviting
Post by: laen on September 08, 2006, 03:57:20 am
Little error in the code above, change it from..

Code: [Select]
else
{
$new = (($toggle == "on") ? 1 : 0);
$this-> bot -> db -> query ("UPDATE members SET auto_invite = $new");

..to..

Code: [Select]
else
{
$new = (($toggle == "on") ? 1 : 0);
$this-> bot -> db -> query ("UPDATE members SET auto_invite = $new WHERE nickname = '$name'");

in the switchauto function.
Title: Re: Updated Autoinv.php to allow for per user inviting
Post by: Snarfblatt on September 11, 2006, 05:40:09 pm
Whoops.. that was a small mistake... :). That might explain a few problems I was having ;).
SimplePortal 2.3.7 © 2008-2024, SimplePortal