__init__.py 文件源码

python
阅读 26 收藏 0 点赞 0 评论 0

项目:Octoslack 作者: fraschetti 项目源码 文件源码
def add_message_reaction(self, slackAPIToken, channel, timestamp, reaction, remove):
        try:
            if reaction == None:
                return

            reaction = reaction.strip()

            if len(reaction) == 0:
                return

            slackAPIConnection = Slacker(slackAPIToken)

            self._logger.debug("Sending Slack RTM reaction - Channel: " + channel + ", Timestamp: " + timestamp + ", Reaction: " + reaction + ", Remove: " + str(remove))

            if remove:
                reaction_rsp = slackAPIConnection.reactions.remove(channel=channel, timestamp=timestamp, name=reaction)
            else:
                reaction_rsp = slackAPIConnection.reactions.add(channel=channel, timestamp=timestamp, name=reaction)

            if reaction_rsp.successful == None or reaction_rsp.successful == False:
                self._logger.debug("Slack RTM send reaction failed - Channel: " + channel + ", Timestamp: " + timestamp + ", Reaction: " + reaction + ", Remove: " + str(remove) + json.dumps(reaction_rsp.body))
            else:
                self._logger.debug("Successfully sent Slack RTM reaction - Channel: " + channel + ", Timestamp: " + timestamp + ", Reaction: " + reaction + ", Remove: " + str(remove))
        except Exception as e:
            self._logger.exception("Error sending Slack RTM reaction - Channel: " + channel + ", Timestamp: " + timestamp + ", Reaction: " + reaction + ", Remove: " + str(remove) + ", Error: " + str(e.message))
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号