.BANCHO. Silences are now logged in RAP and on discord

This commit is contained in:
Nyo
2016-06-07 23:19:45 +02:00
parent ef35697772
commit e11ae27b36
4 changed files with 46 additions and 13 deletions

View File

@@ -242,15 +242,16 @@ class token:
# Logout event
logoutEvent.handle(self, None)
def silence(self, seconds, reason):
def silence(self, seconds, reason, author = 999):
"""
Silences this user (both db and packet)
seconds -- silence length in seconds
reason -- silence reason
author -- userID of who has silenced the target. Optional. Default: 999 (fokabot)
"""
# Silence user in db
userHelper.silence(self.userID, int(time.time())+seconds, reason)
userHelper.silence(self.userID, int(time.time())+seconds, reason, author)
# Send silence packet to target
self.enqueue(serverPackets.silenceEndTime(seconds))
@@ -258,9 +259,6 @@ class token:
# Send silenced packet to everyone else
glob.tokens.enqueueAll(serverPackets.userSilenced(self.userID))
# Log
log.info("{} has been silenced for {} seconds for the following reason: {}".format(self.username, seconds, reason), True)
def spamProtection(self, increaseSpamRate = True):
"""
Silences the user if is spamming.