Пример #1
0
 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
Пример #2
0
 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
Пример #3
0
 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
Пример #4
0
 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'
Пример #5
0
 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'
Пример #6
0
 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)
Пример #7
0
 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')
Пример #8
0
 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')
Пример #9
0
 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)
Пример #10
0
 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)
Пример #11
0
 def handle_command(self, name, command):
     command, args = parse_command(command)
     try:
         return self.commands[command](self, *args)
     except KeyError:
         return 'Invalid command'