-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmutemute.py
48 lines (42 loc) · 1.75 KB
/
mutemute.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
'''
LICENSE: BSD-3
'''
from piqueserver.commands import command, get_player
from twisted.internet.reactor import callLater
def resettimer(self):
self.messagecount = 0
self.timerbeingset = False
def apply_script(protocol, connection, config):
class muteconnection(connection):
lastmessage = ""
howoftenthisonefuckingmessage = 0
messagecount = 0
timerbeingset = False
spammer = False
def on_command(self, command, args):
if command == "pm":
try:
playboy = get_player(self.protocol, args[0])
except:
playboy = None
self.messagecount +=1
if self.messagecount > 15:
self.mute = True
self.spammer = True
if not self.timerbeingset:
callLater(60, resettimer, self)
self.timerbeingset = True
if self.lastmessage == ' '.join(args[1:]):
self.howoftenthisonefuckingmessage+=1
elif self.lastmessage != ' '.join(args[1:]):
self.howoftenthisonefuckingmessage = 0
if self.howoftenthisonefuckingmessage > 5:
self.mute = True
self.spammer = True
if self.mute:
self.send_chat("You are muted"+(self.spammer)*(" due to abuse of the pm command")+". To be able to send /pm's, write us with /admin")
return False
if playboy is not None:
self.lastmessage = ' '.join(args[1:])
return connection.on_command(self, command, args)
return protocol, muteconnection