def on_chat(self, message): if self.time_last_chat < int(reactor.seconds() - constants.ANTISPAM_LIMIT_CHAT): self.chat_messages_burst = 0 else: if self.chat_messages_burst < constants.ANTISPAM_BURST_CHAT: self.chat_messages_burst += 1 else: self.time_last_chat = reactor.seconds() res = self.scripts.call('on_spamming_chat').result if not res: # As we do not want to spam back only do this when # burst limit is reached for the first time if self.chat_messages_burst == constants.ANTISPAM_BURST_CHAT: if self.server.config.base.auto_kick_spam: self.kick('Kicked for chat spamming') else: self.send_chat('[ANTISPAM] Please do not spam in chat!') return if message.startswith('/'): command, args = parse_command(message[1:]) self.on_command(command, args) return event = self.scripts.call('on_chat', message=message) if event.result is False: return return event.message
def on_chat(self, message): if message.startswith('/'): command, args = parse_command(message[1:]) self.on_command(command, args) return event = self.scripts.call('on_chat', message=message) if event.result is False: return return event.message
def handle_command(self, name, command): command, args = parse_command(command) try: return self.commands[command](self, *args) except KeyError: pass ret = self.server.call_command(self.interface, command, args) if ret is not None: return ret return 'Invalid command'
def lineReceived(self, line): if line.startswith('/'): command, args = parse_command(line[1:]) if command == 'stop': self.server.stop() return ret = self.server.call_command(self.interface, command, args) if not ret: return self.sendLine(ret) else: self.server.send_chat(line)
def handle_line(self, line): if not line.startswith('/'): self.server.send_chat(line) return command, args = parse_command(line[1:]) if command == 'stop': self.server.stop() return ret = self.server.call_command(self.interface, command, args) if not ret: return write_stdout(ret + '\n')
def lineReceived(self, line): if line.startswith('/'): command, args = parse_command(line[1:]) if command == 'stop': self.server.stop() return ret = self.server.call_command(self.interface, command, args) if not ret: return self.sendLine(ret.encode(stdout.encoding, 'replace')) else: self.server.send_chat(line)
def on_chat(self, message): if message.startswith('/'): command, args = parse_command(message[1:]) self.on_command(command, args) return False self.call_scripts('on_chat', message)
def handle_command(self, name, command): command, args = parse_command(command) try: return self.commands[command](self, *args) except KeyError: return 'Invalid command'