L* R*
HOME FORUM DOWNLOADS
Content
  Links
     Browse SVN
     SVN Commit log
     Documentation (Wiki)
  Developers
     Taskmanager
User
Welcome, Guest. Please login or register.
Did you miss your activation email?
November 22, 2008, 01:28:29 PM

Login with username, password and session length
Search



Advanced search
Support GoPHP5.org
BeBot - An Anarchy Online/Age Of Conan chat automaton > Forum > Modules > Modules for older versions > 0.2.x Custom/Unofficial Modules > Topic: Modified Blacklist
Pages: [1] 2   Go Down
« previous next »
Print
Author Topic: Modified Blacklist  (Read 2126 times)
0 Members and 1 Guest are viewing this topic.
jjones666
BeBot Contributor
Champion
*******
Offline Offline

Posts: 353


Modified Blacklist
« on: September 09, 2006, 07:04:37 PM »

based on the standard !blacklist plugin (coded by Foxferal).

improved over original (imo):

- removed code to check if user exists via .xml download and replaced with aoc -> get_uid (burn in hell crappy FC servers).
- if blacklist is empty, it will tell you that with no blob.
- shows blacklist blob when adding and deleting people (if applicable).
- make it impossible to add duplicate entries.
- output also shows !whois clicky for each name (combined with !postit feature, this is very useful).
- changed rem to del, in line with most other plugins.
- colour scheme matches most other plugins.
- updated helpfiles.

http://www.jjones.co.uk/files/blacklist.php
http://www.jjones.co.uk/files/blacklist.txt

-jj-
Logged
deathentry
Freshman
*
Offline Offline

Posts: 1


Re: Modified Blacklist
« Reply #1 on: November 01, 2006, 09:51:11 PM »

this is perfect only thing i'd like to do is add a reason for the ban too Smiley
Logged
Naturalistic
BeBot Contributor
Experienced
*******
Offline Offline

Posts: 221


Re: Modified Blacklist
« Reply #2 on: November 01, 2006, 10:00:20 PM »

I was fooling around with another copy, and figured I might as well post it. Found it to be pretty useful.

Could mod mine to implement the few extra changes from Jack's.

PS: This one includes reasons, but not modified from Jack's (modded from the original)
Logged

220/25 Eternalist Doctor
-----------------------------
Campalot Coding Co-ordinator and Super Admin
http://www.campalot.info/index.php
Dracutza
Apprentice
***
Offline Offline

Posts: 126


Re: Modified Blacklist
« Reply #3 on: November 25, 2006, 02:21:54 AM »

Love both of these, so i am trying to combine the two.  Hoping someone here can give me a hand.

Using jjones as the base, and just adding the "added by" and "reason" from Naturalistic.

Everything is set up and converted correctly for the most part. I'm to a point where if i do !blacklist add player1 is properly entered into the db.  !blacklist shows player1 [whois] added by Dracutza Reason:

if i type !blacklist add player1 test, where test would be the reason, I get Player player1 test does not exist.

however... i can edit the db directly, entering a reason, and the reason displays as expected.

Unfortunately, the Sets new name in blacklist section (roughly starting on line 95) in both mods is completely different.  Copying the INSERT INTO line from Naturalistics works fine, except for the reason value.  It's obviously related to how each reads the add command and how the name to be blacklisted ($msg???) is created, but i know zero php, and several things I tried have had no positive effect.

Can maybe one of you tell me what i need to be looking at to get this to accept the reason?
« Last Edit: November 25, 2006, 02:58:31 AM by Dracutza » Logged
Naturalistic
BeBot Contributor
Experienced
*******
Offline Offline

Posts: 221


Re: Modified Blacklist
« Reply #4 on: November 25, 2006, 09:37:57 AM »

Issue with mine was the ' need to change to HTML before inserting into the DB.

Forgot to add that Tongue
Logged

220/25 Eternalist Doctor
-----------------------------
Campalot Coding Co-ordinator and Super Admin
http://www.campalot.info/index.php
jjones666
BeBot Contributor
Champion
*******
Offline Offline

Posts: 353


Re: Modified Blacklist
« Reply #5 on: November 26, 2006, 05:37:23 PM »

- added "blacklisted by" record.
- added (optional) "reason" - if you omit a reason, it will default to "see player notes" - we use !postit feature to record information usually in org.
- works in tell now also.
- alts lookup clicky added to !blacklist output.
- updated helpfiles.

http://www.jjones.co.uk/files/blacklist.php
http://www.jjones.co.uk/files/blacklist.txt
Logged
jjones666
BeBot Contributor
Champion
*******
Offline Offline

Posts: 353


Re: Modified Blacklist
« Reply #6 on: November 27, 2006, 05:52:55 AM »

Oops, had some DynDNS problems earlier - resolved now.

-jj-
Logged
Dracutza
Apprentice
***
Offline Offline

Posts: 126


Re: Modified Blacklist
« Reply #7 on: November 27, 2006, 10:22:25 AM »

thank you for this. I'll have to take a look at it later tonight.  I did manage to edit yours to the point where it will record the submitter and a reason. It works well up to the point when someone does not include a reason.  We require a reason so the enduser can determine the value of the blacklist entry.  We've had members blacklist people because "So and So didn't tip for a wrangle."  Requiring a reason at least allows other to determine the value of the blacklist entry.  Anyway, if a reason is not entered, the bot does nothing.  So now I am trying to figure out how to make the bot reply back that a reason is needed.

Thanks again.
Logged
jjones666
BeBot Contributor
Champion
*******
Offline Offline

Posts: 353


Re: Modified Blacklist
« Reply #8 on: November 27, 2006, 11:14:35 AM »

Hmm, my update isn't restrictive over the reason, simply because I find the !postit option better as this is more accessable from !whois.  If you want it restrictive, I can do this later and post the code I suppose...?

-jj-
Logged
Dracutza
Apprentice
***
Offline Offline

Posts: 126


Re: Modified Blacklist
« Reply #9 on: November 27, 2006, 11:56:00 AM »

maybe i should clarify that by "editing yours", i was refering to the one you had posted on 9-9.  I have not yet tried the one posted over this weekend.

If you are so compelled to resolve my little problem, I've attached my version of blacklist.  What would probably take someone with experience a few minutes will take me a few hours of trial and error, but I'm not afraid of getting this done on my own.  Even if i should be afraid of Wolfbiter flaming me for unethical coding   Cheesy

In any event, that you all for the help already, and really making a great bot.
Logged
jjones666
BeBot Contributor
Champion
*******
Offline Offline

Posts: 353


Re: Modified Blacklist
« Reply #10 on: November 27, 2006, 12:05:07 PM »

Wolfbiter rocks, at least Bebot wise.

Natu, well, apart from being superadmin-of-some-bot-or-other, I'm still waiting for his updated depot module and he is persistant troller on Zodsnet forum :-)

(And, I'll have a look at the code later for you).

-jj-
Logged
jjones666
BeBot Contributor
Champion
*******
Offline Offline

Posts: 353


Re: Modified Blacklist
« Reply #11 on: November 27, 2006, 03:07:45 PM »

Quote from: Dracutza on November 27, 2006, 11:56:00 AM
maybe i should clarify that by "editing yours", i was refering to the one you had posted on 9-9.  I have not yet tried the one posted over this weekend.

If you are so compelled to resolve my little problem, I've attached my version of blacklist.  What would probably take someone with experience a few minutes will take me a few hours of trial and error, but I'm not afraid of getting this done on my own.  Even if i should be afraid of Wolfbiter flaming me for unethical coding   Cheesy

In any event, that you all for the help already, and really making a great bot.

Ok try replacing the code to handle messages in the module I posted yesterday with the below.  Should be fine for what you need I hope.

-jj-

Code:
/*
This gets called on a msg in the privgroup with the command
*/
function pgmsg($name, $msg)
{
if (preg_match("/^" . $this -> bot -> commpre . "blacklist add ([^\s]+) (.+)$/i", $msg, $info))
$this -> bot -> send_pgroup($this -> set_blacklist($name, $info[1], $info[2]));
else if (preg_match("/^" . $this -> bot -> commpre . "blacklist add (.+)$/i", $msg, $info))
{
$msg = "You must enter a reason!";
$this -> bot -> send_pgroup($msg);
}
else if (preg_match("/^" . $this -> bot -> commpre . "blacklist del (.+)$/i", $msg, $info))
$this -> bot -> send_pgroup($this -> del_blacklist($name, $info[1]));
else if (preg_match("/^" . $this -> bot -> commpre . "blacklist{0,1}$/i", $msg))
$this -> bot -> send_pgroup($this -> get_blacklist());
else
$this -> bot -> send_pgroup($this -> get_blacklist());
}


/*
This gets called on a msg in the guildchat with the command
*/
function tell($name, $msg)
{

if (preg_match("/^" . $this -> bot -> commpre . "blacklist add ([^\s]+) (.+)$/i", $msg, $info))
$this -> bot -> send_tell($name, $this -> set_blacklist($name, $info[1], $info[2]));
else if (preg_match("/^" . $this -> bot -> commpre . "blacklist add (.+)$/i", $msg, $info))
{
$msg = "You must enter a reason!";
$this -> bot -> send_tell($name, $msg);
}
else if (preg_match("/^" . $this -> bot -> commpre . "blacklist del (.+)$/i", $msg, $info))
$this -> bot -> send_tell($name, $this -> del_blacklist($name, $info[1]));
else if (preg_match("/^" . $this -> bot -> commpre . "blacklist{0,1}$/i", $msg))
$this -> bot -> send_tell($name, $this -> get_blacklist());
else
$this -> bot -> send_tell($name, $this -> get_blacklist());
}


/*
This gets called on a msg in the guildchat with the command
*/
function gc($name, $msg)
{
if (preg_match("/^" . $this -> bot -> commpre . "blacklist add ([^\s]+) (.+)$/i", $msg, $info))
$this -> bot -> send_gc($this -> set_blacklist($name, $info[1], $info[2]));
else if (preg_match("/^" . $this -> bot -> commpre . "blacklist add (.+)$/i", $msg, $info))
{
$msg = "You must enter a reason!";
$this -> bot -> send_gc($msg);
}
else if (preg_match("/^" . $this -> bot -> commpre . "blacklist del (.+)$/i", $msg, $info))
$this -> bot -> send_gc($this -> del_blacklist($name, $info[1]));
else if (preg_match("/^" . $this -> bot -> commpre . "blacklist{0,1}$/i", $msg))
$this -> bot -> send_gc($this -> get_blacklist());
else
$this -> bot ->send_gc($this -> get_blacklist());
}
Logged
Khalem
BeBot Founder
Administrator
Grandmaster
********
Offline Offline

Gender: Male
Posts: 670



WWW
Re: Modified Blacklist
« Reply #12 on: November 27, 2006, 04:36:45 PM »

Just a suggestion JJ.

You might want to look at how we handle commands in newer modules in SVN. Imho it's a cleaner way, although i still need to clean up more.
See http://svn.shadow-realm.org/index.py/BeBot/trunk/modules/Roster.php?revision=247&view=markup as an example.

Basically, common handler for all messages (avoids typos and code repetition), common handler is told what type of command it is so it can handle tells differenly from pgroup etc if wanted. But most importantly, the way commands are parsed.
First we split the incoming string into variables ($vars) using explode(), then we strip the command prefix, assign the actual command passed to $command for easy parsing and reference, and then use switch() to handle what we today use regexp for.

What i still need to do with this is more as much code as possible out of the main command handler, for example, the error checking done there now on each command should be done inside send_out instead. But non the less, it should serve as a decent example of what i think is a better way to do command handling.
Logged

BeBot Founder and Fixer Kingpin
Madman coder and destroyer of good code
jjones666
BeBot Contributor
Champion
*******
Offline Offline

Posts: 353


Re: Modified Blacklist
« Reply #13 on: November 30, 2006, 03:23:36 AM »

Khalem,

Would that type of command processing work in Bebot 0.2.x?

I agree, it does look a lot simpler...

-jj-
Logged
Naturalistic
BeBot Contributor
Experienced
*******
Offline Offline

Posts: 221


Re: Modified Blacklist
« Reply #14 on: November 30, 2006, 11:25:07 AM »

I would have to disagree about adding it... 0.2.x is going out of date Wink

Logged

220/25 Eternalist Doctor
-----------------------------
Campalot Coding Co-ordinator and Super Admin
http://www.campalot.info/index.php
Pages: [1] 2   Go Up
Print
BeBot - An Anarchy Online/Age Of Conan chat automaton > Forum > Modules > Modules for older versions > 0.2.x Custom/Unofficial Modules > Topic: Modified Blacklist
« previous next »
 
Jump to:  

Recent
Change text in remember "...
by gerborg
[November 21, 2008, 05:14:57 PM]

Log playtime from buddys ...
by Temar
[November 20, 2008, 10:33:57 AM]

Vote Core module and Simp...
by Temar
[November 19, 2008, 09:26:52 AM]

Restrict access for one m...
by Organizer
[November 19, 2008, 03:21:19 AM]

Custom / Revised Modules ...
by Elesar1
[November 17, 2008, 03:51:46 PM]

TWC
by Temar
[November 16, 2008, 11:39:12 AM]

Are there any FUN modules...
by Elesar1
[November 15, 2008, 07:39:15 PM]

Call to a member function...
by exxie
[November 15, 2008, 09:29:31 AM]

Ported Modules
by Alreadythere
[November 14, 2008, 06:10:07 PM]

cURL and other non-defaul...
by Temar
[November 14, 2008, 04:11:44 PM]
Stats
Members
Total Members: 1235
Latest: DDDepressionnn
Stats
Total Posts: 11037
Total Topics: 1496
Online Today: 18
Online Ever: 168
(July 01, 2007, 09:30:02 PM)
Users Online
Users: 0
Guests: 20
Total: 20

Powered by SMF 1.1.7 | SMF © 2006-2008, Simple Machines LLC
TinyPortal v0.9.8 © Bloc | NewDef design by Bloc
Page created in 0.66 seconds with 28 queries. (Pretty URLs adds 0.034s, 4q)
Loading...