def add_spamming_case(self, ip): if ip in self.spammerlist.keys(): self.spammerlist[ip] += 1 if self.spammerlist[ip] > warnings: self.dealwithspammer(ip) del self.spammerlist[ip] else: playerByIpString(ip).message(warning(warn_spam_message.substitute(colordict))) else: self.spammerlist[ip] = 1 playerByIpString(ip).message(warning(warn_spam_message.substitute(colordict)))
def add_spamming_case(self, ip): if ip in self.spammerlist.keys(): self.spammerlist[ip] += 1 if self.spammerlist[ip] > warnings: self.dealwithspammer(ip) del self.spammerlist[ip] else: playerByIpString(ip).message( warning(warn_spam_message.substitute(colordict))) else: self.spammerlist[ip] = 1 playerByIpString(ip).message( warning(warn_spam_message.substitute(colordict)))
def dealwithspammer(self, ip): try: playercn = playerByIpString(ip).cn ban(playercn, ban_duration, 'spamming server', -1) except ValueError: print "Error while banning spamming player by IP"