collapse collapse
* User Info
 
 
Welcome, Guest. Please login or register.
* Search

* Board Stats
  • stats Total Members: 989
  • stats Total Posts: 18365
  • stats Total Topics: 2500
  • stats Total Categories: 7
  • stats Total Boards: 35
  • stats Most Online: 1144

Author Topic: Modified Blacklist  (Read 16987 times)

0 Members and 1 Guest are viewing this topic.

Offline jjones666

  • Contributor
  • *******
  • Posts: 353
  • Karma: +0/-0
Modified Blacklist
« on: September 10, 2006, 02:04:37 am »
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-

Offline deathentry

  • BeBot Rookie
  • *
  • Posts: 1
  • Karma: +0/-0
Re: Modified Blacklist
« Reply #1 on: November 02, 2006, 03:51:11 am »
this is perfect only thing i'd like to do is add a reason for the ban too :)

Offline Naturalistic

  • Contributor
  • *******
  • Posts: 221
  • Karma: +0/-0
Re: Modified Blacklist
« Reply #2 on: November 02, 2006, 04:00:20 am »
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)
220/25 Eternalist Doctor
-----------------------------
Campalot Coding Co-ordinator and Super Admin
http://www.campalot.info/index.php

Offline Dracutza

  • BeBot Apprentice
  • ***
  • Posts: 126
  • Karma: +0/-0
Re: Modified Blacklist
« Reply #3 on: November 25, 2006, 08: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, 08:58:31 am by Dracutza »

Offline Naturalistic

  • Contributor
  • *******
  • Posts: 221
  • Karma: +0/-0
Re: Modified Blacklist
« Reply #4 on: November 25, 2006, 03:37:57 pm »
Issue with mine was the ' need to change to HTML before inserting into the DB.

Forgot to add that :P
220/25 Eternalist Doctor
-----------------------------
Campalot Coding Co-ordinator and Super Admin
http://www.campalot.info/index.php

Offline jjones666

  • Contributor
  • *******
  • Posts: 353
  • Karma: +0/-0
Re: Modified Blacklist
« Reply #5 on: November 26, 2006, 11: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

Offline jjones666

  • Contributor
  • *******
  • Posts: 353
  • Karma: +0/-0
Re: Modified Blacklist
« Reply #6 on: November 27, 2006, 11:52:55 am »
Oops, had some DynDNS problems earlier - resolved now.

-jj-

Offline Dracutza

  • BeBot Apprentice
  • ***
  • Posts: 126
  • Karma: +0/-0
Re: Modified Blacklist
« Reply #7 on: November 27, 2006, 04:22:25 pm »
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.

Offline jjones666

  • Contributor
  • *******
  • Posts: 353
  • Karma: +0/-0
Re: Modified Blacklist
« Reply #8 on: November 27, 2006, 05:14:35 pm »
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-

Offline Dracutza

  • BeBot Apprentice
  • ***
  • Posts: 126
  • Karma: +0/-0
Re: Modified Blacklist
« Reply #9 on: November 27, 2006, 05:56:00 pm »
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   :D

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

Offline jjones666

  • Contributor
  • *******
  • Posts: 353
  • Karma: +0/-0
Re: Modified Blacklist
« Reply #10 on: November 27, 2006, 06: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-

Offline jjones666

  • Contributor
  • *******
  • Posts: 353
  • Karma: +0/-0
Re: Modified Blacklist
« Reply #11 on: November 27, 2006, 09:07:45 pm »
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   :D

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: [Select]
/*
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());
}

Offline Khalem

  • BeBot Founder
  • Administrator
  • ********
  • Posts: 1169
  • Karma: +0/-0
    • http://www.ancarim.com
Re: Modified Blacklist
« Reply #12 on: November 27, 2006, 10: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.
BeBot Founder and Fixer Kingpin

Offline jjones666

  • Contributor
  • *******
  • Posts: 353
  • Karma: +0/-0
Re: Modified Blacklist
« Reply #13 on: November 30, 2006, 09: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-

Offline Naturalistic

  • Contributor
  • *******
  • Posts: 221
  • Karma: +0/-0
Re: Modified Blacklist
« Reply #14 on: November 30, 2006, 05:25:07 pm »
I would have to disagree about adding it... 0.2.x is going out of date ;)

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

 

* Recent Posts
0.8.x updates for AO by bitnykk
[June 23, 2024, 03:19:47 pm ]


0.8.x updates for AoC by bitnykk
[June 23, 2024, 03:19:44 pm ]


[AoC] special char for items module by bitnykk
[February 09, 2024, 09:41:18 pm ]


BeBot still alive & kicking ! by bitnykk
[December 17, 2023, 12:58:44 am ]


Bebot and Rasberry by bitnykk
[November 29, 2023, 11:04:14 pm ]

* Who's Online
  • Dot Guests: 93
  • Dot Hidden: 0
  • Dot Users: 0

There aren't any users online.
* Forum Staff
bitnykk admin bitnykk
Administrator
Khalem admin Khalem
Administrator
WeZoN gmod WeZoN
Global Moderator
SimplePortal 2.3.7 © 2008-2024, SimplePortal