BeBot - An Anarchy Online and Age Of Conan chat automaton

Archive => Anarchy Online Archive => BeBot 0.3 support => Topic started by: Temar on June 19, 2007, 05:13:16 am

Title: bugs in 0.3.4
Post by: Temar on June 19, 2007, 05:13:16 am
i think i found 2 bugs in 0.3.4
New install no changed

1st is !admin del name
it crashed the bot

next is !blacklist rem name
wouldnt remove some 1, had to do it manualy
Title: Re: bugs in 0.3.4
Post by: Ebag333 on June 19, 2007, 06:40:59 am
Don't use !admin, instead use !adduser and !deluser.

!admin appears to be deprecated, and a comment notes that it will be going away in .5.  Not sure who added that, but I'd avoid using it.  :)

Incidentally someone needs to write help for the security module....admin should probably go away too since it's been replaced by other commands...
Title: Re: bugs in 0.3.4
Post by: Alreadythere on June 19, 2007, 12:33:43 pm
Fixed the !admin del bug, and added help for the security module.
Title: Re: bugs in 0.3.4
Post by: Temar on June 19, 2007, 02:04:37 pm
i have now notice a security issue
with the !alts and admin to all alts
if a user who is admin does have an alt any 1 can make him an alt and become admin
i think a fix would be you cant add admin to your alt list unless you have that security level or higher
Title: Re: bugs in 0.3.4
Post by: Alreadythere on June 19, 2007, 02:28:14 pm
It's a general problem with the way alts are defined. Only way would be to enforce a two-way alt adding, meaning the main and the alt have to invoke some command.

This of course would create more some complexity.
Title: Re: bugs in 0.3.4
Post by: Temar on June 19, 2007, 03:17:28 pm
i was hoping for somit more simple

like this

name1 - member
name2 - admin

when name1 tries to add name2 as an alt it does a check
see that name2 is admin and check is name1 same or better security level?
if no Dont do it!
Title: Re: bugs in 0.3.4
Post by: Khalem on June 19, 2007, 03:40:07 pm
I was discussing this with Blue earlier and we agreed that we have two choices on this. And i think we need to address this before 0.4 as it's a critical issue.

1: A challenge system. Player A adds Player B as an alt. A random AUTH string (md5?) is generated and stored in a new databse table, lets name it auth. There we store the requesting playername, time of the request, an integer to designate the request type (to allow the table to be used for more auth related stuff in the future) and the target name.

Player B will then be sent a blob containing a brief explanation with a link to click which will then when clicked send say a /tell botname alts auth <auth string>

This should probably be coupled with a new setting which allows you to restrict adding alts to alts that are also members of the bot (to prevent abuse by doing for example !alts add Sirillion over and over. This would also go well with the second way outlined below. On a side note, to prevent spamming and abuse, you should not be able to rerequest an alt which you have an active auth pending for. And one might in addition consider having a settable enforced delay between alt add's.

2: We have a password table, put it to use. Allow setting a password, and then allowing that password to be used when adding an alt, bypassing the auth requirement.

These two options are the best i've come up with so far, and combined they make for a nice system allowing security and flexibility (i've been thinking of this for a while since it would be nice for a raidbot)

Additionally you could add another layer to the auth mechanism (optional via setting) to require admin approval as well in addition to being confirmed by the target player, or maybe just admin approved (think forum registration options).

Thoughts?
Title: Re: bugs in 0.3.4
Post by: Temar on June 19, 2007, 04:11:54 pm
those are good ideas
but till then i added a small bit to my alts.php

Code: [Select]
// Check if the Alt being Added has Higher Security
if ($this -> bot -> security -> get_access_level($name) < $this -> bot -> security -> get_access_level($alt))
{
return "##error##Character ##highlight##$alt##end## is Higher User Level and Cannot be Added as your Alt.##end##";
}
i added this on Alts.php in modules Direction on function add_alt($name, $alt)
i added it before it did the actual adding and after the rest of the checks
 
Title: Re: bugs in 0.3.4
Post by: Ebag333 on June 19, 2007, 06:35:15 pm
Option 1 sounds cool, but *WAY* too complex.  Most of my users wouldn't be able to figure that out.

Option 2 sounds more feasible, but also increases the complexity quite a bit.


This problem only occurs with people who do not have alts set.  So there is no need for any of these measures if the person has alts set.

It seems to me that the person with the highest access on the bot should be the main.  So as Chris suggested a simple check to see if the person has a higher access level than the person trying to add them as their alt should fix the problem.  This closes the hole, and doesn't really increase complexity all that much (not nearly as much as option 1 or 2 would).  A slightly clearer message than what Chris has should be added ("Admin level" is ambiguous and implies it has something to do with the specific access level of Admin, rather than admin in a general sense).
Title: Re: bugs in 0.3.4
Post by: Temar on June 19, 2007, 06:44:58 pm
Quote
This problem only occurs with people who do not have alts set.  So there is no need for any of these measures if the person has alts set.
in my case i has set all Advisors of org to admin im  nto sure if they all have alts set etc and this may change

i have changed Admin Level to User Level
Title: Re: bugs in 0.3.4
Post by: Temar on June 19, 2007, 07:17:47 pm
i got another bug with !help

[Leetboss2]: /tell Leetboss2 !help !irc
To [Leetboss2]: !help !irc
[Leetboss2]: No help found for !irc
To [Leetboss2]: !help irc
[Leetboss2]: help on irc

The bot is telling me to put a ! before the help subject but its no longer used
Title: Re: bugs in 0.3.4
Post by: Temar on June 19, 2007, 07:19:37 pm
Also there is no help on !irc i know there is a section in setting but it would be nice to put that command in !help irc
just incase they dont know
Title: Re: bugs in 0.3.4
Post by: Ebag333 on June 19, 2007, 07:27:25 pm
Indeed, ever since post the release of 0.3.3 (when we started on 0.3.4) !help expects command, and not <pre>command.

That's something that should be allowed either way...
Title: Re: bugs in 0.3.4
Post by: Khalem on June 19, 2007, 07:41:51 pm
Option 1 sounds cool, but *WAY* too complex.  Most of my users wouldn't be able to figure that out.

How is it complex?
Player A: /tell botname !alts add Player B
Bot: /tell Player B Player A has requested that you be added as an alt, click here to confirm
Player B: Clicks link
Bot: /tell Player B You are now an confirmed alt of Player A

If people think it's to complex to click a link, they probably cant handle playing AO in the first place imho.

Thanx for the reports btw Chris. And good catch on the alts issue.
Title: Re: bugs in 0.3.4
Post by: Alreadythere on June 19, 2007, 08:30:55 pm
#1 is easiest to use I think, at least from the user point of view. Just clicking a link shouldn't be too hard.

#2 is more comfortable as we could allow adding of mains then using the password.

Your fix is ok Chris, just the way you implemented it now makes every adding of a character with higher access rights as alt to you impossible, even using altadmin. I'd move the check out of the add_alt() function.
Title: Re: bugs in 0.3.4
Post by: Temar on June 19, 2007, 10:44:24 pm
im just trying to setup a raid bot now i dont fully understand this flexiable security but sounds like wat i want
i did this command
!set Flexible_security Guest_group member
Bot died and gave this error
Fatal error: Call to a member function on a non-object in /root/Battle150/modules/SettingsInterface.php on line 217
Title: Re: bugs in 0.3.4
Post by: Alreadythere on June 19, 2007, 11:27:48 pm
What's the line? I can't see any error in the SVN version (0.3.4 svn version, not head).
Title: Re: bugs in 0.3.4
Post by: Temar on June 19, 2007, 11:36:37 pm
got the error again just by turning autoinv on
the line reads
      $module = $this -> bot -> settings -> remove_space($module);
Title: Re: bugs in 0.3.4
Post by: Alreadythere on June 20, 2007, 12:04:23 am
That line is from the head version in the SVN, not the 0.3.4 version available as packaged download.
I'd guess you are using the old settings.php but a new settingsinterface - you have to use the same version for both.
But if you are mainly using the 0.3.4 package instead of the 0.3.5-svn (head) version, you'll run into lot's of trouble of the kind you just ran into if you switch settings.php to the new version.

Since release of 0.3.4 there was one bigger change in SVN, the way settings are accessed changed. With that the variable to call changed too, from set to settings.
Title: Re: bugs in 0.3.4
Post by: Temar on June 20, 2007, 12:41:25 am
i might have done it by accident when trying to fix the !admin rem error by downloading a newer file from svn
Title: Re: bugs in 0.3.4
Post by: Temar on June 20, 2007, 12:51:27 am
i restored the files to 0.3.4 release and its not crashing now to figure out wat i do with Guest_Group / flizible security thing lol
Title: Re: bugs in 0.3.4
Post by: Temar on June 20, 2007, 04:54:17 am
i have a prob :/
i imported my member list from older version of bot
which is fine i put it in the user table ok the prob is
all the members are Not on buddylist
so no autoinvites :/

and also all the member should of already been on there but i think the bot removed them but i duno why
Title: Re: bugs in 0.3.4
Post by: Temar on June 20, 2007, 04:55:47 am
[2007-06-20 00:10:39]   [CRON]   [ROSTER]   Done updating roster. Removed 0 members of which 0 was rerolled characters.
[2007-06-20 00:10:39]   [CRON]   [ROSTER]   Cleaning buddylist.
[2007-06-20 00:10:39]   [ROSTER]   [BUDDY-DEL]   Sneakz66
...........................BIG list of Deletes
[2007-06-20 00:10:39]   [CRON]   [ROSTER]   Cleaning buddylist done. 151 buddies removed.
Title: Re: bugs in 0.3.4
Post by: Ebag333 on June 20, 2007, 08:41:33 am
I've ran into this myself.  Periodically (not every time) the member/buddy list gets wiped.

Not quite sure whats causing it.
Title: Re: bugs in 0.3.4
Post by: Glarawyn on June 20, 2007, 08:48:03 am
Option 1 sounds cool, but *WAY* too complex.  Most of my users wouldn't be able to figure that out.

How is it complex?
Player A: /tell botname !alts add Player B
Bot: /tell Player B Player A has requested that you be added as an alt, click here to confirm
Player B: Clicks link
Bot: /tell Player B You are now an confirmed alt of Player A

If people think it's to complex to click a link, they probably cant handle playing AO in the first place imho.

Thanx for the reports btw Chris. And good catch on the alts issue.


I like it and have thought of doing the same thing myself on Campalot.
Title: Re: bugs in 0.3.4
Post by: Temar on June 20, 2007, 03:12:27 pm
this is prob the part that does it in roster.php
Code: [Select]
function update_raid()
{
// die("Do not run this version without knowing what you are getting into. Raid Roster has not been properly tested.\nComment out this die() call if you are feeling adventureus.");
$this -> bot -> log("ROSTER", "UPDATE", "Starting roster update");

$buddies = $this -> bot -> aoc -> buddies;
$num = 0;
$this -> removed = 0;
$this -> rerolled = 0;

$members = $this -> bot -> db -> select("SELECT char_id, nickname, user_level FROM #___users");
if (!empty($members))
{
foreach ($members as $member)
{
$id = $this -> bot -> aoc -> get_uid($member[1]);

/*
Catch deleted characters.
*/
if (!$id)
{
$this -> erase("Roster", $member[0], $member[1], "as the character appears to have been deleted.");
}

/*
Catch rerolled characters.
*/
else if ($id != $member[0])
{
$this -> erase("Roster", $member[0], $member[1], "as the character appears to have been rerolled. Old: $member[0] New: $id");
$this -> rerolled++;
}

/*
If not we just run trough the paces and make sure everything is in order.
*/
else
{
/*
Make sure we have an entry in the whois cache for the character.
*/
$this -> bot -> whois -> lookup($member[1]);

if ($member[2] == 3)
{
/*
Make sure the admin is on the buddylist.
*/
if (!$this -> bot -> aoc -> buddy_exists($id))
{
$this -> bot -> aoc -> buddy_add($id);
$this -> bot -> log("ROSTER", "BUDDY-ADD", $member[1]);
}

/*
Make sure we don't remove the admin from the buddylist in the final step
*/
unset($buddies[$member[0]]);
}
}
}
}
$this -> bot -> log("CRON", "ROSTER", "Done updating roster. Removed " . $this -> removed . " members of which " . $this -> rerolled . " was rerolled characters.");

$this -> bot -> log("CRON", "ROSTER", "Cleaning buddylist.");
/*
cycle trough anything still on our buddylist
*/
foreach ($buddies as $id => $value)
{
$name = $this -> bot -> aoc -> get_uname($id);
$this -> bot -> aoc -> buddy_remove($id);
$this -> bot -> log("ROSTER", "BUDDY-DEL", $name);
$num++;
}
$this -> bot -> log("CRON", "ROSTER", "Cleaning buddylist done. $num buddies removed.");
}
can you see whats wrong?
Title: Re: bugs in 0.3.4
Post by: Alreadythere on June 20, 2007, 03:20:53 pm
It's trying to get the admins by user_level = 3, which isn't used in the users table anymore though.

Grab the current SVN version and try it, it doesn't contain any settings calls, so shouldn't create any errors there.

To get your buddies back you'll have to set notify = 1 in your users table for all members (user_level = 2). something like UPDATE users SET notify = 1 WHERE user_level = 2 in SQL should do that. Replace users with your tablename, include any prefix.
Title: Re: bugs in 0.3.4
Post by: Temar on June 20, 2007, 03:39:50 pm
i can get my old buddies bk easy ill just run old bot and let it do it
Title: Re: bugs in 0.3.4
Post by: Alreadythere on June 20, 2007, 03:43:51 pm
If you want to keep them with bebot you'll have to set notify = 1.
Title: Re: bugs in 0.3.4
Post by: Temar on June 20, 2007, 03:53:07 pm
they were already set to that
well after changeing for the svn roster i ran bot and it readded all the member to buddy list :D
Title: Re: bugs in 0.3.4
Post by: Ebag333 on June 20, 2007, 06:01:46 pm
If you want to keep them with bebot you'll have to set notify = 1.

Pfft, I know that.

Only happens on the raid portion of the roster, incidentally.
Title: Re: bugs in 0.3.4
Post by: Temar on June 20, 2007, 08:27:47 pm
why have u changed !invite to !inviteuser and wat does !invite do now?
Title: Re: bugs in 0.3.4
Post by: Glarawyn on June 20, 2007, 08:34:24 pm
why have u changed !invite to !inviteuser and wat does !invite do now?

Yeah it bugs the crap out of me too. :)

/tell bot !invite - bot invites you if you're allowed to join the pgroup. Alias of !join.
/tell bot !invite <name> - bot invites <name> if person calling is allowed to invite.

I imagine the change is due to the access control system, but it also shows the main weakness of access control system. The security system is not without it's flaws as well. :)

Maybe at some point access control can be expansed for subcommands/command parameters...
Title: Re: bugs in 0.3.4
Post by: Vhab on June 20, 2007, 09:55:34 pm
I ran into the same problem regarding !invite with vhabot aswell.
So I just made !invite only for inviting other people and !join only for getting an invite yourself.
Title: Re: bugs in 0.3.4
Post by: Glarawyn on June 20, 2007, 10:01:29 pm
I ran into the same problem regarding !invite with vhabot aswell.
So I just made !invite only for inviting other people and !join only for getting an invite yourself.

I've made this modification to all my bots that use a private group as well.
Title: Re: bugs in 0.3.4
Post by: Temar on June 21, 2007, 08:50:09 pm
Well i changed !invite to actualy Invite and got rid of !inviteuser now which works fine
i also tried moving some code from my Old privgroup to this new 1 for features such as faction restriction on !join and !invite

i get this error when trying to set a faction
Code: [Select]
Fatal error: Call to a member function on a non-object in /Sources/Bot.php on line 470

altho not finished this is how my privgroup is now
Code: [Select]
<?php
/*
* PrivGroup.php - Basic featureset for private group handeling (join/kick etc)
*
* BeBot - An Anarchy Online Chat Automaton
* Copyright (C) 2004 Jonas Jax
* Copyright (C) 2005 Thomas J. Stens� and ShadowRealm Creations
*
* Developed by:
* - Blondengy (RK1)
* - Khalem (RK1)
*
* See Credits file for all aknowledgements.
*
*  This program is free software; you can redistribute it and/or modify
*  it under the terms of the GNU General Public License as published by
*  the Free Software Foundation; either version 2 of the License, or
*  (at your option) any later version.
*
*  This program is distributed in the hope that it will be useful,
*  but WITHOUT ANY WARRANTY; without even the implied warranty of
*  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
*  GNU General Public License for more details.
*
*  You should have received a copy of the GNU General Public License
*  along with this program; if not, write to the Free Software
*  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307
*  USA
*
* File last changed at $LastChangedDate: 2007-06-08 11:26:40 +0200 (Fri, 08 Jun 2007) $
* Revision: $Id: PrivGroup.php 594 2007-06-08 09:26:40Z alreadythere $
*/


$privgroup = new PrivGroup($bot);

if (
$bot -> guildbot)
{
$joindef "gc";
$leavedef "gc";
}
else
{
$joindef "pgmsg";
$leavedef "none";
}
$longjoin "Which chat channels should be notified about joins to the private chat channel?";
$longleave "Which chat channels should be notified about leave to the private chat channel?";

$bot -> set -> create("PrivGroup""EchoJoin"$joindef$longjoin"none;pgmsg;gc;both");
$bot -> set -> create("PrivGroup""EchoLeave"$leavedef$longleave"none;pgmsg;gc;both");
$bot -> set -> create("PrivGroup""JoinString""#!NICKNAME!# (#!LEVEL!#/#!AT_ID!# #!FACTION!# #!PROFESSION!#, #!ORG!#) has joined #!BOTNAME!#""Formating string for join notifications."""TRUE);
$bot -> set -> create("PrivGroup""LeaveString""#!NICKNAME!# has left #!BOTNAME!#""Formating string for leave notifications."""TRUE);
$bot -> set -> create("PrivGroup""Deactivated"FALSE"Is joining the private chat deactived?");
$bot -> set -> create("PrivGroup""DeactivatedText""Private chatgroup is disabled!""The text shown if the private chat cannot be joined.""");

unset(
$longjoin);
unset(
$longleave);
unset(
$joindef);
unset(
$leavedef);

// Create sane default levels for the commands
$bot -> accesscontrol -> create("tell""join""GUEST");
$bot -> accesscontrol -> create("tell""chat""GUEST");
//$bot -> accesscontrol -> create("tell", "invite", "GUEST");
$bot -> accesscontrol -> create("tell""leave""ANONYMOUS");
$bot -> accesscontrol -> create("tell""kick""ANONYMOUS");
$bot -> accesscontrol -> create("tell""invite""LEADER");
$bot -> accesscontrol -> create("pgmsg""invite""LEADER");
$bot -> accesscontrol -> create("pgmsg""leave""ANONYMOUS");
$bot -> accesscontrol -> create("pgmsg""kick""ANONYMOUS");
$bot -> accesscontrol -> create("pgmsg""kickuser""LEADER");
$bot -> accesscontrol -> create("pgmsg""kickall""ADMIN");
$bot -> accesscontrol -> create("gc""join""MEMBER");
$bot -> accesscontrol -> create("gc""invite""ADMIN");
$bot -> accesscontrol -> create("gc""kickuser""ADMIN");
$bot -> accesscontrol -> create("gc""kickall""ADMIN");
$bot -> accesscontrol -> create("tell""lock""ADMIN");
$bot -> accesscontrol -> create("tell""faction""ADMIN");
$bot -> accesscontrol -> create("tell""forceinvite""ADMIN");
$bot -> accesscontrol -> create("tell""maxplayers""ADMIN");
$bot -> accesscontrol -> create("pgmsg""lock""ADMIN");
$bot -> accesscontrol -> create("pgmsg""faction""ADMIN");
$bot -> accesscontrol -> create("pgmsg""forceinvite""ADMIN");
$bot -> accesscontrol -> create("pgmsg""maxplayers""ADMIN");



$commands["tell"]["join"] = &$privgroup;
$commands["tell"]["chat"] = &$privgroup;
$commands["tell"]["leave"] = &$privgroup;
$commands["tell"]["kick"] = &$privgroup;
$commands["tell"]["invite"] = &$privgroup;
$commands["tell"]["invite"] = &$privgroup;
$commands["pgmsg"]["leave"] = &$privgroup;
$commands["pgmsg"]["invite"] = &$privgroup;
$commands["pgmsg"]["kick"] = &$privgroup;
$commands["pgmsg"]["kickuser"] = &$privgroup;
$commands["pgmsg"]["kickall"] = &$privgroup;
$commands["gc"]["join"] = &$privgroup;
$commands["gc"]["invite"] = &$privgroup;
$commands["gc"]["kickuser"] = &$privgroup;
$commands["gc"]["kickall"] = &$privgroup;
$commands['tell']['lock'] = &$PrivGroup;
$commands['tell']['faction'] = &$PrivGroup;
$commands['tell']['forceinvite'] = &$PrivGroup;
$commands['tell']['maxplayers'] = &$PrivGroup;
$commands['pgmsg']['lock'] = &$PrivGroup;
$commands['pgmsg']['faction'] = &$PrivGroup;
$commands['pgmsg']['forceinvite'] = &$PrivGroup;
$commands['pgmsg']['maxplayers'] = &$PrivGroup;



$commands["pgjoin"][] = &$privgroup;
$commands["pgleave"][] = &$privgroup;



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


/*
Constructor:
Hands over a referance to the "Bot" class.
*/
function PrivGroup (&$bot)
{
$this -> bot = &$bot;

$this -> help['description'] = 'Module to handle the privat group.';
$this -> help['command']['join']="Join the private group of the bot.";
$this -> help['command']['chat']="Join the private group of the bot.";
// $this -> help['command']['invite']="Join the private group of the bot.";
$this -> help['command']['leave'] = "Leave the private group of the bot.";
$this -> help['command']['kick'] = "Leave the private group of the bot.";
$this -> help['command']['invite <name>'] = "Invites the player <name> to the private group of the bot.";
$this -> help['command']['kickuser <name>'] = "Kicks player <name> from the private group of the bot.";
$this -> help['command']['kickall'] = "Completely empties the private group of the bot.";

$this -> faction 'Clan';
$this -> mode 'include';
$this -> lock 'disabled';
$this -> maxplayers '200';

}



/*
This gets called on a tell with the command
*/
function tell($name$msg)
{
if (preg_match("/^" $this -> bot -> commpre "join/i"$msg)
// || preg_match("/^" . $this -> bot -> commpre . "invite$/i", $msg)
|| preg_match("/^" $this -> bot -> commpre "chat/i"$msg))
{
if ($this -> bot -> settings["Privgroup"]["Deactivated"])
{
$this -> bot -> send_tell($name$this -> bot -> settings["Privgroup"]["Deactivatedtext"]);
}
else
{
$this -> bot -> aoc -> privategroup_invite($name);
}
}
else if (preg_match("/^" $this -> bot -> commpre "leave/i"$msg)
|| preg_match("/^" $this -> bot -> commpre "kick$/i"$msg))
$this -> bot -> aoc -> privategroup_kick($name);
else if (preg_match("/^" $this -> bot -> commpre "invite (.+)$/i"$msg$info))
{
if ($this -> bot -> settings["Privgroup"]["Deactivated"])
{
$this -> bot -> send_tell($name$this -> bot -> settings["Privgroup"]["Deactivatedtext"]);
}
else
{
$this -> invite($name"tell"$info[1]);
}
}
else if (preg_match('/^'.$this -> bot -> commpre.'lock/i'$msg$info)) $c $this -> lock($name);
else if (preg_match('/^'.$this -> bot -> commpre.'maxplayers *([-0-9]+)*/i'$msg$info)) $c = isset($info['1']) ? $this -> max_players($name$info['1']) : $this -> max_players($name'return');
else if (preg_match('/^'.$this -> bot -> commpre.'forceinvite (.+)$/i'$msg$info)) $c $this -> forceinvite($nameucfirst($info['1']));
else if (preg_match('/^'.$this -> bot -> commpre.'faction exclude (.+)/i'$msg$info)) $c $this -> faction($name'exclude'ucfirst($info['1']));
else if (preg_match('/^'.$this -> bot -> commpre.'faction (.+)$/i'$msg$info)) $c $this -> faction($name'include'ucfirst($info['1']));
else $c =  $this -> bot -> send_help($name);
       
$c != '' $this -> bot -> send_tell($name$c) : NULL;

}



/*
This gets called on a msg in the privgroup with the command
*/
function pgmsg($name$msg)
{
if (preg_match("/^" $this -> bot -> commpre "leave/i"$msg))
$this -> bot -> aoc -> privategroup_kick($name);
else if (preg_match("/^" $this -> bot -> commpre "kick$/i"$msg))
$this -> bot -> aoc -> privategroup_kick($name);
else if (preg_match("/^" $this -> bot -> commpre "invite (.+)$/i"$msg$info))
$this -> invite($name"pgmsg"$info[1]);
else if (preg_match("/^" $this -> bot -> commpre "kickuser (.+)$/i"$msg$info))
$this -> bot -> aoc -> privategroup_kick($info[1]);
else if (preg_match("/^" $this -> bot -> commpre "kickall$/i"$msg))
$this -> kick_all($name);
else if (preg_match('/^'.$this -> bot -> commpre.'lock/i'$msg$info)) $c $this -> lock($name);
else if (preg_match('/^'.$this -> bot -> commpre.'maxplayers *([-0-9]+)*/i'$msg$info)) $c = isset($info['1']) ? $this -> max_players($name$info['1']) : $this -> max_players($name'return');
else if (preg_match('/^'.$this -> bot -> commpre.'forceinvite (.+)$/i'$msg$info)) $c $this -> forceinvite($nameucfirst($info['1']));
else if (preg_match('/^'.$this -> bot -> commpre.'faction exclude (.+)/i'$msg$info)) $c $this -> faction($name'exclude'ucfirst($info['1']));
else if (preg_match('/^'.$this -> bot -> commpre.'faction (.+)$/i'$msg$info)) $c $this -> faction($name'include'ucfirst($info['1']));
$c != '' $this -> bot -> send_pgroup($c) : NULL;
}




/*
This gets called on a msg in the guildchat with the command
*/
function gc($name$msg)
{
if (preg_match("/^" $this -> bot -> commpre "join/i"$msg))
{
if ($this -> bot -> settings["Privgroup"]["Deactivated"])
{
$this -> bot -> send_gc($this -> bot -> settings["Privgroup"]["Deactivatedtext"]);
}
else
{
$this -> bot -> aoc -> privategroup_invite($name);
}
}
else if (preg_match("/^" $this -> bot -> commpre "invite (.+)$/i"$msg$info))
{
if ($this -> bot -> settings["Privgroup"]["Deactivated"])
{
$this -> bot -> send_gc($this -> bot -> settings["Privgroup"]["Deactivatedtext"]);
}
else
{
$this -> invite($name"gc"$info[1]);
}
}
else if (preg_match("/^" $this -> bot -> commpre "kickuser (.+)$/i"$msg$info))
$this -> bot -> aoc -> privategroup_kick($info[1]);
else if (preg_match("/^" $this -> bot -> commpre "kickall$/i"$msg$info))
$this -> kick_all($name"gc");
}



/*
Invite a user to private group.
*/
function invite($from$type$who)
{
if ($this -> bot -> botname == $who)
{
$msg "You cannot invite the bot to its own chat group";
}
else if ($this -> bot -> aoc -> get_uid($who))
{
if($this -> faction($who'''') == '1') {
$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 "Bot invites are currently restricted to<font color=#ffff00>".$this -> faction."</font>.";
}
else
{
$msg "Player <font color=#ffff00>" $who "</font> does not exist.";
}

if ($type == "tell")
$this -> bot -> send_tell($from$msg);
else if ($type == "pgmsg")
$this -> bot -> send_pgroup($msg);
else
$this -> bot -> send_gc($msg);
}

function kick_all($name$chan "pgmsg")
{
$text "##highlight##" $name " ##end##kicked all users from the private group!";
if ($chan == "gc")
{
$this -> bot -> send_gc($text);
}
$this -> bot -> send_pgroup($text);

$this -> bot -> aoc -> privategroup_kick_all();
}

function pgjoin($name)
{
if ($this -> bot -> settings["Privgroup"]["Echojoin"] == "none")
return;

// Parse the string first:
$text $this -> parse_text($name$this -> bot -> settings["Privgroup"]["Joinstring"], "has joined");

switch (strtolower($this -> bot -> settings["Privgroup"]["Echojoin"]))
{
case "gc":
$this -> bot -> send_gc($text);
break;
case "pgmsg":
$this -> bot -> send_pgroup($text);
break;
case "both":
$this -> bot -> send_pgroup($text);
$this -> bot -> send_gc($text);
break;
default:
break;
}
}

function pgleave($name)
{
if ($this -> bot -> settings["Privgroup"]["Echoleave"] == "none")
return;

// Parse the string first:
$text $this -> parse_text($name$this -> bot -> settings["Privgroup"]["Leavestring"], "has left");

switch (strtolower($this -> bot -> settings["Privgroup"]["Echoleave"]))
{
case "gc":
$this -> bot -> send_gc($text);
break;
case "pgmsg":
$this -> bot -> send_pgroup($text);
break;
case "both":
$this -> bot -> send_pgroup($text);
$this -> bot -> send_gc($text);
break;
default:
break;
}
}

function parse_text($name$string$actionstring)
{
$info $this -> bot -> whois -> lookup($name);

// Only "Name joined bot" if no whois entry was found
if ($info["error"])
{
return "##highlight##" $name " ##end##" $actionstring " " $this -> bot -> botname;
}

foreach ($info as $key => $value)
{
$string eregi_replace("#!" $key "!#""##highlight##" $value "</font>"$string);
}

$string  eregi_replace("#!BOTNAME!#"$this -> bot -> botname$string);

return $string;
}


function forceinvite($name$who) {
if($this -> bot -> botname != $who) {
if(!$this -> bot -> commands['tell']['banlist'] -> bancheck($who)) {
if($this -> bot -> commands['pgmsg']['leader'] -> raidleader == $name || $this -> bot -> admin -> in_group($name'admin')) {
$this -> bot -> aoc -> privategroup_invite($who);
$c $this -> highlight_1.$who.'</font> has been invited to <botname>.';
} else $c 'You do not have permission to use this command.';
} else $c 'Please do not try and to invite <botname>.';
} else $c $this -> highlight_1.$who.'</font> is banned from <botname>.';
return $c;
}

function lock($name) {
if($this -> bot -> commands['pgmsg']['leader'] -> raidleader == $name || $this -> bot -> admin -> in_group($name'admin')) {
$this -> lock $this -> lock == 'enabled' 'disabled' 'enabled';
$c 'The bot lock has been '.$this -> highlight_1.$this -> lock.'</font> by '.$this -> highlight_1.$name.'</font>.';
} else $c 'You do not have permission to use this command.';
return $c;
}

function faction($name$mode$msg) {
if($msg != '') {
if($msg == 'Omni' || $msg == 'Clan' || $msg == 'Neutral' || $msg == 'All') {
if($msg != 'All' || $mode != 'exclude') {
$this -> mode $mode;
$this -> faction $msg;
$c 'Invites changed to '.$this -> highlight_1.$msg.$faction.' </font>faction by '.$this -> highlight_1.$name.'</font>.';
} else $c 'You cannot exclude everyone from bot invites.';
} else $c 'The faction '.$this -> highlight_1.$msg.'</font> does not exist.';
return $c;
}
else {
$this -> user $this -> bot -> whois -> lookup($name);
if($this -> faction == 'All' || $this -> faction == $this -> user['faction']) return 1;
else return false;
}
}

function max_players($name$msg) {
if($msg == 'return') return 'Maximum players currently set to '.$this -> highlight_1.$this -> maxplayers.'</font>.';
if($this -> bot -> commands['pgmsg']['leader'] -> raidleader == $name || $this -> bot -> admin -> in_group($name'admin')) {
if($msg '0') {
$this -> maxplayers $msg;
$c 'Maximum players set to '.$this -> highlight_1.$msg.'</font> by '.$this -> highlight_1.$name.'</font>.';
}  else $c 'You cannot set maximum players below 1.';
} else $c 'You do not have permission to use tihs command.';
return $c;
}

}
?>

Title: Re: bugs in 0.3.4
Post by: Khalem on June 21, 2007, 10:11:24 pm
I ran into the same problem regarding !invite with vhabot aswell.
So I just made !invite only for inviting other people and !join only for getting an invite yourself.

If i get my hands on whoever did this, i'll kill em!!
Ok, not really.

But yeah, annoying as hell. !invite <user> is the expected functionality, so i suggest we just revert back to what Vhab suggested.
Title: Re: bugs in 0.3.4
Post by: Ebag333 on June 21, 2007, 10:32:44 pm
The "problem" is that !invite and !invite <person> should have two different access levels.

For example, I may want random people to be able to join my bot, but not invite other people (only my members can do that).

The trouble will be keeping the two seperate while using the same command.

Since *MANY* bots use !invite instead of !chat or !join (who came up with !chat BTW?), it's kinda the norm for people to /tell bot !invite to join the bot.

If you make it so that !invite functions like !inviteuser, then you're removing that standard, and people will complain about that. :)

Darned if you do, darned if you don't.
Title: Re: bugs in 0.3.4
Post by: Temar on June 21, 2007, 11:47:57 pm
ive always known !invite to be to invite other never my self
and !join is for myself
Title: Re: bugs in 0.3.4
Post by: Alreadythere on June 22, 2007, 12:18:01 am
If i get my hands on whoever did this, i'll kill em!!
Ok, not really.
Lol guilty as charged.

I don't really care what way the commands are called, I just didn't like the double use of them due to the access levels. And I'm no friend of abusing settings for subcommands.

That being said, if we move back to !invite user we'll run into the same problem with !kickuser and !kick. Quite a lot of people I see using bots expect !kick to work to leave bots, instead of !leave.
Title: Re: bugs in 0.3.4
Post by: Temar on June 22, 2007, 02:42:13 am
maybe u should make so if nothing get put after !kick or wateva its like !leave but if there is like a name the kick that name
Title: Re: bugs in 0.3.4
Post by: Khalem on June 22, 2007, 05:25:12 am
imho, we should just throw an error message stating permission denied if someone tries to use !kick and doesnt have permission to use it. People do learn, and it will ultimately be up to the bot admin what to allow.

Using !kick instead of !leave is just lazyness, and from what i've witnessed over the years, if !kick fails, most people automatically do !leave.

I think the same applies for !invite. Just a force of habit :)
And ultimately i think its more annoying in the long run for !invite <user> not to work.
Title: Re: bugs in 0.3.4
Post by: Temar on June 23, 2007, 01:08:54 pm
Also the Prefix thing has i problem i think
as u only set prefix to "botname" and end up with "botname_tablename"
i noticed when i put nothing as prefix i ended with tables named "_tablename"
you should have it so the user put the _ in them selfs which is how all things with prefix work from my experience
Title: Re: bugs in 0.3.4
Post by: Ebag333 on June 23, 2007, 06:20:46 pm
Also the Prefix thing has i problem i think
as u only set prefix to "botname" and end up with "botname_tablename"
i noticed when i put nothing as prefix i ended with tables named "_tablename"
you should have it so the user put the _ in them selfs which is how all things with prefix work from my experience

Yeah, I noticed that myself.

I just checked the code, and this is what we have

Code: [Select]
<php?
if (empty($table_prefix))
{
$this -> table_suffix = strtolower($botname);
}
else
{
$this -> table_prefix = $table_prefix;
}
?>

Changed table_suffix to table_prefix as I can't find table_suffix anywhere else in the code.

Now if you don't specify a prefix, it's always botname_tablename.

Committed to SVN.
Title: Re: bugs in 0.3.4
Post by: Alreadythere on June 23, 2007, 06:59:37 pm
I guess that error ended in when I did the multiple bot change...
Title: Re: bugs in 0.3.4
Post by: Temar on June 25, 2007, 05:37:03 pm
!say
well if i do it on gc it doesnt do anything
if i do it on /tell it sends a /tell bk with msg
is it broke or somit?
Title: Re: bugs in 0.3.4
Post by: Alreadythere on June 25, 2007, 05:41:01 pm
I think the 0.3.4 version is broken, though the svn version should be fixed.
Title: Re: bugs in 0.3.4
Post by: Glarawyn on June 26, 2007, 06:09:09 am
Say.php:

http://bebot.link/index.php/topic,801.msg6141.html#msg6141
Title: Re: bugs in 0.3.4
Post by: Temar on July 07, 2007, 01:06:36 pm
I noticed you have somit that lets you do !invite <name> now in the SVN privgroup module
does that mean u fixed the access problem? so like !invite useing to join is different than the !invite <name> to invite
SimplePortal 2.3.7 © 2008-2024, SimplePortal