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
def removeSession(self, immediately): # construct IQUI message ClientManager.getInstance().removeClient(self) # broadcast bot quited message Broadcast.getInstance().broadcast("IQUI " + self.getSid(), self)
t = Timer(10.0, self.getRss) t.start() return def removeSession(self, immediately): # construct IQUI message ClientManager.getInstance().removeClient(self) # broadcast bot quited message Broadcast.getInstance().broadcast("IQUI " + self.getSid(), self) # main function if __name__ == "__main__": bot = PythonBot() bot.setSid("PBOT") bot.setCid(CIDGenerator.generate()) bot.setDescription(AdcUtils.toAdcString(u"Я могу много чего, спроси меня")) bot.setEmail(u"*****@*****.**") bot.setWeight(10) bot.setClientType(ClientType.BOT) bot.setValidated() bot.setActive(True) bot.setMustBeDisconnected(False) ClientManager.getInstance().addClient(bot) Broadcast.getInstance().broadcast(bot.getINF(), bot) t = Timer(10.0, bot.getRss) t.start()