def channel_part(self, sender, nick): sender_ref = api.actor_lookup_mobile(api.ROOT, sender) if not sender_ref: raise exception.ValidationError(HELP_SIGN_IN) channel = clean.channel(nick) try: api.channel_part(sender_ref, sender_ref.nick, channel) self.send_message((sender, ), "%s left %s" % (sender_ref.display_nick(), nick)) except: self.send_message((sender, ), "Failed to leave %s" % nick)
def channel_part(self, from_jid, nick): jid_ref = api.actor_lookup_im(api.ROOT, from_jid.base()) if not jid_ref: raise exception.ValidationError( "You must be signed in to leave a channel, please SIGN IN") channel = clean.channel(nick) try: api.channel_part(jid_ref, jid_ref.nick, channel) self.send_message((from_jid, ), "%s parted %s" % (jid_ref.nick, channel)) except: self.send_message((from_jid, ), "Leave FAILED: %s" % channel)