def message_handler(self, msg, status): if status == skype4py.cmsReceived: if msg.Type == skype4py.cmeEmoted: Globals.commands.send_message(u"[Skype] *\x02%s\x02\u202d %s*" % (msg.FromDisplayName.replace("\u202e", ""), msg.Body), self) return else: Globals.commands.send_message(u"[Skype] \x02%s\x02\u202d: %s" % (msg.FromDisplayName, msg.Body), self) if msg.Body.startswith(Globals.settings.COMMAND_PREFIX): args, cmd = Globals.commands.parse_args(msg.Body) environ = os.environ.copy() environ["NAME"] = msg.FromDisplayName environ["SKYPE_HANDLE"] = msg.FromHandle environ["protocol"] = self Globals.commands(cmd, args[1:], environ) else: Globals.commands.general(self, msg.FromDisplayName, msg.Body)
def privmsg(self, user, channel, message, action=False): #no privmsgs pls if channel == self.factory.channel: name = user.split("!")[0] if action: Globals.commands.send_message(u"[IRC] *\x02%s\x02\u202d %s*" % (name, message), self.factory) return else: Globals.commands.send_message(u"[IRC] \x02%s\x02\u202d: %s" % (name, message), self.factory) if message.startswith(Globals.settings.COMMAND_PREFIX): args, cmd = Globals.commands.parse_args(message) environ = os.environ.copy() environ["NAME"] = name environ["protocol"] = self.factory Globals.commands(cmd, args[1:], environ) else: Globals.commands.general(self.factory, user, message)