如何将 Slack 反应添加到 send_card

How to add a Slack reaction to a send_card

我有一个发送 Slack 卡片的 Errbot 函数。然后我如何在卡片上添加反应而不是收到的原始消息 (msg)?

@botcmd
def example(self, msg):
    self.send_card(title='Test',
            body='test123',
            thumbnail=' ',
            image=' ',
            link=' ',
            color='green',
            in_reply_to=msg)
    self._bot.add_reaction(card_msg??, 'grey_question')

send_card does not return to you the message it sends 这意味着您必须执行一些操作才能获取您发送的卡片的消息信息。

一种选择是在您的插件中触发 callback for all messages,检查消息,然后在其中添加您的反应:

另一种选择是使用 slack backend api call 方法搜索您的消息并以这种方式添加反应。