Beispiel #1
0
    def sendRawCommand(self, rawCommand):
        # create MSG object from rawCommand
        message = MSG(rawCommand)

        # trying to get message (to be sure rawCommand is a MSG action)
        try:
            messageString = message.getMessage()
        except CommandException:
            return

        # trying to find substring with word 'bor'
        if messageString.find("bor") == 0:
            # construct outgoing message to send it to chat
            self.sendMessageToChat(u"Кто-то жаждит бор!")
        return
Beispiel #2
0
 def sendMessageToChat(self, message):
     outgoingMessage = MSG()
     outgoingMessage.setMessage(message)
     outgoingMessage.setMessageType(MessageType.B)
     outgoingMessage.setSourceSID(self.getSid())
     # send outgoing message
     Broadcast.getInstance().broadcast(outgoingMessage.getRawCommand(), self)
     return