def tempban(self, reason='', keyword=None, duration=2, admin=None, silent=False, data='', *kwargs): """ Tempban this client. :param reason: The reason for this tempban :param keyword: The keyword specified before the reason :param duration: The duration of the tempban :param admin: The admin who performed the tempban :param silent: Whether or not to announce this tempban :param data: Extra data to add to the penalty """ duration = functions.time2minutes(duration) self.console.tempban(self, reason, duration, admin, silent) if self.id: ban = ClientTempBan() if admin: ban.adminId = admin.id else: ban.adminId = 0 ban.clientId = self.id ban.data = data ban.duration = duration ban.keyword = keyword ban.reason = reason ban.timeExpire = self.console.time() + (duration * 60) ban.save(self.console)
def tempban(self, reason='', keyword=None, duration=2, admin=None, silent=False, data='', *kwargs): duration = functions.time2minutes(duration) self.console.tempban(self, reason, duration, admin, silent) if self.id: ban = ClientTempBan() ban.timeExpire = self.console.time() + (duration * 60) ban.clientId = self.id ban.duration = duration ban.keyword = keyword ban.data = data if admin: ban.adminId = admin.id else: ban.adminId = 0 ban.reason = reason ban.save(self.console)
def warn(self, duration, warning, keyword=None, admin=None, data=''): if self.id: duration = functions.time2minutes(duration) warn = ClientWarning() warn.timeExpire = self.console.time() + (duration * 60) warn.clientId = self.id warn.duration = duration warn.data = data if admin: warn.adminId = admin.id else: warn.adminId = 0 warn.reason = warning warn.keyword = keyword warn.save(self.console) return warn return None
def warn(self, duration, warning, keyword=None, admin=None, data=''): """ Warn this client. :param duration: The duration of this warning :param warning: The reason for this warning :param keyword: The keyword specified before the reason :param admin: The admin who performed the ban :param data: Extra data to add to the penalty """ if self.id: duration = functions.time2minutes(duration) warn = ClientWarning() if admin: warn.adminId = admin.id else: warn.adminId = 0 warn.clientId = self.id warn.data = data warn.duration = duration warn.keyword = keyword warn.reason = warning warn.timeExpire = self.console.time() + (duration * 60) warn.save(self.console) if self.console: self.console.queueEvent( self.console.getEvent('EVT_CLIENT_WARN', data={ 'reason': warn.reason, 'duration': warn.duration, 'data': warn.data, 'admin': admin, 'timeExpire': warn.timeExpire }, client=self)) return warn
def warn(self, duration, warning, keyword=None, admin=None, data=''): """ Warn this client. :param duration: The duration of this warning :param warning: The reason for this warning :param keyword: The keyword specified before the reason :param admin: The admin who performed the ban :param data: Extra data to add to the penalty """ if self.id: duration = functions.time2minutes(duration) warn = ClientWarning() if admin: warn.adminId = admin.id else: warn.adminId = 0 warn.clientId = self.id warn.data = data warn.duration = duration warn.keyword = keyword warn.reason = warning warn.timeExpire = self.console.time() + (duration * 60) warn.save(self.console) if self.console: self.console.queueEvent(self.console.getEvent('EVT_CLIENT_WARN', data={ 'reason': warn.reason, 'duration': warn.duration, 'data': warn.data, 'admin': admin, 'timeExpire': warn.timeExpire }, client=self)) return warn
def _set_duration(self, v): self._duration = functions.time2minutes(v)