[AntiAbuse] Add !listignore, fix a bug
This commit is contained in:
parent
418e72a19d
commit
70e868d934
@ -1,6 +1,6 @@
|
|||||||
Commands
|
Commands
|
||||||
========
|
========
|
||||||
Required arguments are enclosed in { and }, optional arguments are enclosed in \[ and \]
|
Required arguments are enclosed in { and }, optional arguments are enclosed in [ and ]
|
||||||
|
|
||||||
<i>$botname</i> refers to the name of the IRC bot, e.g. MinetestBot
|
<i>$botname</i> refers to the name of the IRC bot, e.g. MinetestBot
|
||||||
|
|
||||||
@ -16,6 +16,7 @@ Required arguments are enclosed in { and }, optional arguments are enclosed in \
|
|||||||
<tr> <td><b>antiabuse.py</b></td> <td></td> <td></td> </tr>
|
<tr> <td><b>antiabuse.py</b></td> <td></td> <td></td> </tr>
|
||||||
<tr> <td>!ignore {user}</td> <td>Add user to ignore list</td> <td><i>Admins</i></td> </tr>
|
<tr> <td>!ignore {user}</td> <td>Add user to ignore list</td> <td><i>Admins</i></td> </tr>
|
||||||
<tr> <td>!unignore {user}</td> <td>Remove user from ignore list</td> <td><i>Admins</i></td> </tr>
|
<tr> <td>!unignore {user}</td> <td>Remove user from ignore list</td> <td><i>Admins</i></td> </tr>
|
||||||
|
<tr> <td>!listignore</td> <td>List all ignored users</td> <td><i>Admins</i></td> </tr>
|
||||||
<tr> <td><b>calc.py</b></td> <td></td> <td></td> </tr>
|
<tr> <td><b>calc.py</b></td> <td></td> <td></td> </tr>
|
||||||
<tr> <td>!c {expression}</td> <td>Calculate expression</td> <td>Anyone</td> </tr>
|
<tr> <td>!c {expression}</td> <td>Calculate expression</td> <td>Anyone</td> </tr>
|
||||||
<tr> <td><b>chop.py</b></td> <td></td> <td></td> </tr>
|
<tr> <td><b>chop.py</b></td> <td></td> <td></td> </tr>
|
||||||
|
16
antiabuse.py
16
antiabuse.py
@ -6,8 +6,8 @@ Copyright 2012, sfan5
|
|||||||
import time, sqlite3
|
import time, sqlite3
|
||||||
|
|
||||||
antiabuse = {}
|
antiabuse = {}
|
||||||
antiabuse["timeout"] = {}
|
|
||||||
antiabuse["ignorelist"] = []
|
antiabuse["ignorelist"] = []
|
||||||
|
antiabuse["cooldown_l"] = {}
|
||||||
antiabuse["cooldown"] = 3 # seconds
|
antiabuse["cooldown"] = 3 # seconds
|
||||||
|
|
||||||
def aa_hook(phenny, input):
|
def aa_hook(phenny, input):
|
||||||
@ -21,11 +21,11 @@ def aa_hook(phenny, input):
|
|||||||
|
|
||||||
# Cooldown
|
# Cooldown
|
||||||
try:
|
try:
|
||||||
ot = antiabuse["cooldown"][input.nick]
|
ot = antiabuse["cooldown_l"][input.nick]
|
||||||
except:
|
except:
|
||||||
ot = 0
|
ot = 0
|
||||||
antiabuse["cooldown"][input.nick] = time.time()
|
antiabuse["cooldown_l"][input.nick] = time.time()
|
||||||
if antiabuse["cooldown"][input.nick] - antiabuse["cooldown"] < ot:
|
if antiabuse["cooldown_l"][input.nick] - antiabuse["cooldown"] < ot:
|
||||||
return True # abort command
|
return True # abort command
|
||||||
pass
|
pass
|
||||||
|
|
||||||
@ -82,6 +82,14 @@ def unignore(phenny, input):
|
|||||||
unignore.commands = ['unignore']
|
unignore.commands = ['unignore']
|
||||||
unignore.priority = 'high'
|
unignore.priority = 'high'
|
||||||
|
|
||||||
|
def listignore(phenny, input):
|
||||||
|
if not input.admin:
|
||||||
|
return
|
||||||
|
phenny.reply(', '.join(antiabuse['ignorelist']))
|
||||||
|
|
||||||
|
listignore.commands = ['listignore']
|
||||||
|
listignore.priority = 'high'
|
||||||
|
|
||||||
db = sqlite3.connect("antiabuse.sqlite")
|
db = sqlite3.connect("antiabuse.sqlite")
|
||||||
c = db.cursor()
|
c = db.cursor()
|
||||||
c.execute('''CREATE TABLE IF NOT EXISTS ignore (nick text)''')
|
c.execute('''CREATE TABLE IF NOT EXISTS ignore (nick text)''')
|
||||||
|
Loading…
x
Reference in New Issue
Block a user