示例#1
0
文件: server.py 项目: Jakky89/cuwo
 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
文件: server.py 项目: matpow2/cuwo
 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
文件: irc.py 项目: Endimmion/cuwo
 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
文件: irc.py 项目: CubedWorldNET/cuwo
 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
文件: console.py 项目: matpow2/cuwo
 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
文件: server.py 项目: TomYaMee/cuwo
 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
文件: irc.py 项目: TomYaMee/cuwo
 def handle_command(self, name, command):
     command, args = parse_command(command)
     try:
         return self.commands[command](self, *args)
     except KeyError:
         return 'Invalid command'