def rpc_banUser(self, userId, duration, reason): """ Summary: Bans the user associated with the provided [userId] for the specified [duration]. Parameters: [int/str userId] = The ID of the user to ban. [int duration] = The ban's duration in hours. If this is 0 or less, the user will be permanently banned. [str reason] = A short description of why this user is being banned. This can be one of the following values: 'hacking', 'language', 'other'. Example response: On success: True On failure: False """ if reason not in ('hacking', 'language', 'other'): return False self.air.writeServerEvent('ban', userId, duration, reason) if duration > 0: now = datetime.date.today() release = str(now + datetime.timedelta(hours=duration)) else: release = '0000-00-00' # Permanent ban. executeHttpRequest('accounts/ban/', Id=userId, Release=release, Reason=reason) self.rpc_kickUser(userId, 152, reason) return True
def performBan(self, duration): executeHttpRequest('ban', username=self.accountId, start=int(time.time()), duration=duration, reason=self.comment, bannedby=self.banner)
def performBan(self, bannedUntil): accountDBType = simbase.config.GetString('accountdb-type', 'developer') if accountDBType == 'remote': executeHttpRequest('accounts/ban/', Id=self.accountId, Release=bannedUntil, Reason=self.comment) if accountDBType == 'mysqldb': print (self.update_ban, (int(time.time()), bannedUntil, self.comment, self.bannerId, self.accountId)) self.cur.execute(self.update_ban, (int(time.time()), int(bannedUntil), self.comment, self.bannerId, self.accountId)) self.cnx.commit()
def rpc_banUser(self, userId, duration, reason): if reason not in ('hacking', 'language', 'other'): return False self.air.writeServerEvent('ban', userId, duration, reason) if duration > 0: now = datetime.date.today() release = str(now + datetime.timedelta(hours=duration)) else: release = '0000-00-00' executeHttpRequest('accounts/ban/', Id=userId, Release=release, Reason=reason) self.rpc_kickUser(userId, 152, reason) return True
def performBan(self, bannedUntil): accountDBType = simbase.config.GetString('accountdb-type', 'developer') if accountDBType == 'remote': executeHttpRequest('accounts/ban/', Id=self.accountId, Release=bannedUntil, Reason=self.comment) if accountDBType == 'mysqldb': print( (self.update_ban, (int(time.time()), bannedUntil, self.comment, self.bannerId, self.accountId))) self.cur.execute(self.update_ban, (int(time.time()), int(bannedUntil), self.comment, self.bannerId, self.accountId)) self.cnx.commit()
def rpc_getUserAccountId(self, userId): """ Summary: Responds with the ID of the account associated with the provided [userId]. Parameters: [int/str userId] = The ID of the user to query the account ID on. Example response: On success: 100000000 On failure: None """ response = executeHttpRequest('accountid', username=str(userId)) if response is not None: response = json.loads(response) if response['success'] is True: return int(response['accountId']) else: print response['error'] return False
def performBan(self, bannedUntil): executeHttpRequest('accounts/ban/', Id=self.accountId, Release=bannedUntil, Reason=self.comment)