From 3c85a9e8863a63662481120630769f63d91fa8bf Mon Sep 17 00:00:00 2001 From: Master Jumblespeed Date: Sat, 15 Aug 2015 02:40:35 -0400 Subject: [PATCH] bans: minor changes --- otp/ai/BanManagerAI.py | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) diff --git a/otp/ai/BanManagerAI.py b/otp/ai/BanManagerAI.py index 6cb300fd..a008615e 100755 --- a/otp/ai/BanManagerAI.py +++ b/otp/ai/BanManagerAI.py @@ -1,6 +1,6 @@ from direct.directnotify import DirectNotifyGlobal from toontown.uberdog.ClientServicesManagerUD import executeHttpRequest -import datetime +import time from direct.fsm.FSM import FSM from direct.distributed.PyDatagram import PyDatagram from direct.distributed.MsgTypes import * @@ -22,9 +22,9 @@ class BanFSM(FSM): self.accountId = None self.avName = None - def performBan(self, bannedUntil): - executeHttpRequest('accounts/ban/', Id=self.accountId, Release=bannedUntil, - Reason=self.comment) + def performBan(self, duration): + executeHttpRequest('ban', username=self.accountId, start=int(time.time()), + duration=duration, reason=self.comment, bannedby='todo') def ejectPlayer(self): av = self.air.doId2do.get(self.avId) @@ -49,15 +49,9 @@ class BanFSM(FSM): if not self.accountId: return - date = datetime.date.today() if simbase.config.GetBool('want-bans', True): - if self.duration == 0: - bannedUntil = "0000-00-00" # Terminated. - else: - bannedUntil = date + datetime.timedelta(days=self.duration) - + self.performBan(self.duration) self.duration = None - self.performBan(bannedUntil) def getAvatarDetails(self): av = self.air.doId2do.get(self.avId)