BeBot - An Anarchy Online and Age Of Conan chat automaton

Archive => Anarchy Online Archive => 0.2.x Custom/Unofficial Modules => Topic started by: craized on December 02, 2005, 11:53:56 am

Title: Updated PrivGroup Module - Additional functionality
Post by: craized on December 02, 2005, 11:53:56 am
UPDATED PRIVGROUP (http://www.craized.net/junk/bebot/highlight.php?PrivGroup)

Description:
A module used to control all private group functions.

Features
!lock
Locks and unlocks bot invites.

!forceinvite <player>
Allows admins and raidleader to invite players through a lock and faction restrictions.

!faction <omni|neutral|clan|all>
Allows admins to set which faction will be allowed to enter the bot.

!faction exclude <omni|neutral|clan>
Allows admins to select a faction to be disallowed bot entry.

!leave
Leave the bot.

!kick
Leave the bot.

!kick <player> [reason]
Allows admins to kick a player with optional reason.

!join
Request bot invite.

!chat
Request bot invite.

!invite
Request bot invite.

!invite <player>
Invite other to bot.
Title: Updated PrivGroup Module - Additional functionality
Post by: Xenixa on December 02, 2005, 02:00:12 pm
*Rubs his eye's*

Nope not a Mirrage... that is a Craized posting something new. :)
Title: Updated PrivGroup Module - Additional functionality
Post by: craized on December 02, 2005, 03:43:40 pm
Yea, I'm back for now. :) My org leader needed some bot tweaks and it got me back into it. I plan to be making more modules soon... Haven't wrote any help yet though. ><
Title: Updated PrivGroup Module - Additional functionality
Post by: Wanuarmi on December 02, 2005, 06:30:00 pm
hey shouldnt exclude

if($msg != 'All' || $mode != 'Exclude') {

be in lowercase? thats whats being passed here

else if (preg_match('/^'.$this -> bot -> commpre.'faction exclude (.+)/i', $msg, $info)) $c = $this -> faction($name, 'exclude', ucfirst($info['1']));

oh and it would be very nice if these settings could persist between reboots... if you are not doing that please let me know that Ill have to change mine

ps: guess I only need to change the initial variables
        $this -> faction = 'All';
        $this -> mode = 'include';
Title: Updated PrivGroup Module - Additional functionality
Post by: craized on December 03, 2005, 03:43:37 am
You're right, I'm glad you noticed. I'm updating it as soon as I finish debugging.

I've also tweaked this code. I've added a private group notification when someone tries to enter a locked bot.

Also yea, I don't like cluttering up databases for just a couple things, and I guess I did expect you to hard code in your default settings.

Glad to be back, thanks for the help.
Title: Updated PrivGroup Module - Additional functionality
Post by: Wanuarmi on December 03, 2005, 04:03:51 am
also !leave by tells seems to be broken

np nice job
Title: Updated PrivGroup Module - Additional functionality
Post by: craized on December 03, 2005, 09:21:10 am
Thanks. Actually, I didn't want !leave or !lock to work in tells, so I've removed them from the command list.
Title: Updated PrivGroup Module - Additional functionality
Post by: craized on December 06, 2005, 07:03:35 am
Updated a lot of code, message syntax has changed, and everything works much better. Same link, as usual.
Title: Updated PrivGroup Module - Additional functionality
Post by: Nogoal on December 07, 2005, 09:19:00 am
Error in line 90, in the function join.
Title: Updated PrivGroup Module - Additional functionality
Post by: Xenixa on December 07, 2005, 09:30:26 am
In lines 90 and 97 a closing ")" is missing.
Should look like this:
Code: [Select]
90:   $this -> bot -> send_pgroup(count($this -> bot -> commands['pgmsg']['online'] -> pgroup));

97:   $this -> bot -> send_pgroup($this -> highlight.$name.'</font> has attempted to join <botname>');
Title: Updated PrivGroup Module - Additional functionality
Post by: craized on December 07, 2005, 09:31:31 am
Thank you, updated.
Title: Re: Updated PrivGroup Module - Additional functionality
Post by: craized on December 26, 2005, 10:10:52 pm
Updated to use BANLIST MODULE (http://bebot.link/index.php/topic,287.0.html).
Title: Re: Updated PrivGroup Module - Additional functionality
Post by: ZubZero on January 15, 2006, 06:23:06 pm
Parse error: parser error, unexpected '{' in /home/zubzero/BeBot_v0.2.2/modules/PrivGroup.php on line 70

Havent modified the file or anything.
Running php 4.4.1
Title: Re: Updated PrivGroup Module - Additional functionality
Post by: Xenixa on January 16, 2006, 02:41:30 pm
Just an FYI, some syntax errors I found.

Line 70 needs an extra closing ) before the opening brace.
In line Line 72 ucfirst() is mispelled ucifrst()
Line 77 is missing a concatination period just after $this -> highlight.$who
Line 85 needs an extra closing ) before the opening brace.
Title: Re: Updated PrivGroup Module - Additional functionality
Post by: craized on January 16, 2006, 10:09:00 pm
Thanks, updated.
Title: Re: Updated PrivGroup Module - Additional functionality
Post by: neongen on May 24, 2006, 04:55:37 am
how do i make the !join free so they don't need to be on a guest list to join the guest channel?
Title: Re: Updated PrivGroup Module - Additional functionality
Post by: Xenixa on May 27, 2006, 03:25:58 pm
You will need to move the !join command handler from the tell() to tell2() function is the easiest way to explain that.
Title: Re: Updated PrivGroup Module - Additional functionality
Post by: neongen on July 28, 2006, 02:22:38 pm
sorry havent hade much time to make it on the bot befor now.

but can you plz tell me where to make the tell2() because i can't find it :(
Title: Re: Updated PrivGroup Module - Additional functionality
Post by: Naturalistic on July 28, 2006, 05:04:34 pm
Look in other modules...

Title: Re: Updated PrivGroup Module - Additional functionality
Post by: neongen on July 28, 2006, 06:12:58 pm
i have tryed that now and i only get my bot to restart and say something about a line 368 in bot.php

i'm not so good at php yet. but working on it all i can
Title: Re: Updated PrivGroup Module - Additional functionality
Post by: Tsuyoi on July 28, 2006, 08:23:23 pm
Changes to make to this module to get it working for everyone:

Find:
Code: [Select]
$privgroup = new PrivGroup($bot);

$commands['tell']['join'] = &$privgroup;
$commands['tell']['lock'] &$privgroup; <~~~~ Typo That Needs To Be Fixed
$commands['tell']['chat'] = &$privgroup;
$commands['tell']['leave'] = &$privgroup;
$commands['tell']['invite'] = &$privgroup;

After it Add:
Code: [Select]

$commands['tell2']['join'] = &$privgroup;

Then Find:
Code: [Select]
function tell($name, $msg) {
        if (preg_match('/^'.$this -> bot -> commpre.'invite *([^ ]+)*$/i', $msg, $info)) $c = !isset($info['1']) ? $this -> join($name) : $this -> invite($name, ucfirst($info['1']));
        else if (preg_match('/^'.$this -> bot -> commpre.'join$/i', $msg)) $c = $this -> join($name);
        $c != '' ? $this -> bot -> send_tell($name, $c) : NULL;
    }

And After Add:
Code: [Select]
function tell2($name, $msg) {
        if (preg_match('/^'.$this -> bot -> commpre.'join$/i', $msg)) $c = $this -> join($name);
        $c != '' ? $this -> bot -> send_tell($name, $c) : NULL;
    }

That should give you the results you're looking for.
Title: Re: Updated PrivGroup Module - Additional functionality
Post by: Tsuyoi on July 28, 2006, 08:43:25 pm
While I'm here tho, I was looking over the module and I noticed a few things that seemed alittle off to me.  I apologize if anything I list is as it was intended, so please feel free to correct me if I'm wrong on any of these.

Line 12:
Code: [Select]
$commands['tell']['lock'] &$privgroup;Should be:
Code: [Select]
$commands['tell']['lock'] = &$privgroup;


And on the /tell commands, it has listed that it reacts to 5 different commands via /tell, but only parses 2 of them.  So shouldn't the /tell function look more like:
Code: [Select]
function tell($name, $msg) {
        if (preg_match('/^'.$this -> bot -> commpre.'join$/i', $msg)) $c = $this -> join($name);
        else if (preg_match('/^'.$this -> bot -> commpre.'lock$/i', $msg)) $c = $this -> lock($name);
        else if (preg_match('/^'.$this -> bot -> commpre.'chat$/i', $msg)) $c = $this -> join($name);
        else if (preg_match('/^'.$this -> bot -> commpre.'leave$/i', $msg)) $c = $this -> leave($name);
        else if (preg_match('/^'.$this -> bot -> commpre.'invite *([^ ]+)*$/i', $msg, $info)) $c = !isset($info['1']) ? $this -> join($name) : $this -> invite($name, ucfirst($info['1']));
        $c != '' ? $this -> bot -> send_tell($name, $c) : NULL;
    }



And on the Join function:
Code: [Select]
    function join($name) {
        if(!$this -> bot -> commands['tell']['banlist'] -> bancheck($who)) {

Shouldn't it be:
Code: [Select]
    function join($name) {
        if(!$this -> bot -> commands['tell']['banlist'] -> bancheck($name)) {


If I'm wrong on any of those, I apologize, they just seemed alil off to me. :)
Title: Re: Updated PrivGroup Module - Additional functionality
Post by: Naturalistic on July 28, 2006, 09:18:08 pm
Wow... no wonders I code stuff myself :p

There was a ton of typos/errors in that module... Tsuyoi found most of them :P
Title: Re: Updated PrivGroup Module - Additional functionality
Post by: neongen on July 30, 2006, 11:43:26 am
thx Tsuyoi

now we don't have to have a guest of honor every day. the fix i made did something to the bot so i just took some random people and put them on the bot  :-\

but it looks like you post helped me out there. so tyvm  :)
Title: Re: Updated PrivGroup Module - Additional functionality
Post by: Sammajos on October 08, 2006, 02:17:46 pm
[Bot] MyChar: !facion all
[Bot] Bot: Invites changed to >All faction by >MyChar.
[Bot] MyChar: !faction exclude Clan
[Bot] Bot: Invites changed to >Clan faction by >MyChar.


Ok, dont know, what is wrong here. Im not a big Coder.
Title: Re: Updated PrivGroup Module - Additional functionality
Post by: neongen on October 11, 2006, 12:09:00 am
Quote
[Bot] MyChar: !facion all
[Bot] Bot: Invites changed to >All faction by >MyChar.
[Bot] MyChar: !faction exclude Clan
[Bot] Bot: Invites changed to >Clan faction by >MyChar.

the fast way to do it (don't know if it's the only way) is to change
find:
Quote
$this -> faction = 'Clan';
$this -> mode = 'include';
$this -> lock = 'disabled';
$this -> maxplayers = '200';

change it to:
Quote
$this -> faction = 'Clan';
$this -> mode = 'exclude';
$this -> lock = 'disabled';
$this -> maxplayers = '200';
Title: Re: Updated PrivGroup Module - Additional functionality
Post by: Temar on May 02, 2007, 02:07:13 am
i get this error

Fatal error: Call to a member function on a non-object in (...site addy....)/modules/PrivGroup.php on line 170

Any 1 know why and how to fix or an alt module
main feature i like is the clan only invite thing as i run a bot for battle ship

the line in question reads

         $this -> user = $this -> bot -> whois -> lookup($name);
Title: Re: Updated PrivGroup Module - Additional functionality
Post by: jjones666 on May 02, 2007, 08:06:56 am
You need the module here (http://bebot.link/index.php/topic,223.0.html). 

-jj-
Title: Re: Updated PrivGroup Module - Additional functionality
Post by: Temar on May 02, 2007, 05:10:14 pm
Works now thank you
Title: Re: Updated PrivGroup Module - Additional functionality
Post by: craized on May 21, 2007, 07:23:45 am
I don't know if anyone is still getting anything from this thread, but fixed bugs posted by Tsuyoi
SimplePortal 2.3.7 © 2008-2024, SimplePortal