def post(self, ircMsg): user = ircMsg.user message = ' '.join(ircMsg.msg.split()) post = re.sub('^!identica post ', '', message) m = IRCMessage() m.msg = _("msgIdentiPost").format(user, post) try: self.oauth() self.api = tweepy.API(self.auth, host = self.host, api_root = self.api_root) #self.api.update_status(post[:140]) except: m.msg("msgIdentiFail") return m
def execute(self, ircMsg, userRole): m = IRCMessage() try: msg = ircMsg.msg option = msg.rsplit('identica')[1].strip().split(' ')[0] if option == 'post': m = self.post(ircMsg) elif option == 'pull': m = self.pull(ircMsg) except: ## TODO: raise a different exception. m.msg = _("msgIdentiFail") m.channel = ircMsg.channel m.user = ircMsg.user return m
def activate(self): super(identica, self).activate() print _("msgIdentiEn")