[AntiAbuse] Add !listignore, fix a bug
This commit is contained in:
parent
418e72a19d
commit
70e868d934
@ -1,6 +1,6 @@
|
||||
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
|
||||
|
||||
@ -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>!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>!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>!c {expression}</td> <td>Calculate expression</td> <td>Anyone</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
|
||||
|
||||
antiabuse = {}
|
||||
antiabuse["timeout"] = {}
|
||||
antiabuse["ignorelist"] = []
|
||||
antiabuse["cooldown_l"] = {}
|
||||
antiabuse["cooldown"] = 3 # seconds
|
||||
|
||||
def aa_hook(phenny, input):
|
||||
@ -21,11 +21,11 @@ def aa_hook(phenny, input):
|
||||
|
||||
# Cooldown
|
||||
try:
|
||||
ot = antiabuse["cooldown"][input.nick]
|
||||
ot = antiabuse["cooldown_l"][input.nick]
|
||||
except:
|
||||
ot = 0
|
||||
antiabuse["cooldown"][input.nick] = time.time()
|
||||
if antiabuse["cooldown"][input.nick] - antiabuse["cooldown"] < ot:
|
||||
antiabuse["cooldown_l"][input.nick] = time.time()
|
||||
if antiabuse["cooldown_l"][input.nick] - antiabuse["cooldown"] < ot:
|
||||
return True # abort command
|
||||
pass
|
||||
|
||||
@ -82,6 +82,14 @@ def unignore(phenny, input):
|
||||
unignore.commands = ['unignore']
|
||||
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")
|
||||
c = db.cursor()
|
||||
c.execute('''CREATE TABLE IF NOT EXISTS ignore (nick text)''')
|
||||
|
Loading…
x
Reference in New Issue
Block a user