Slack:如何在不添加Slack的情况下删除消息的操作按钮? [英] Slack: How can I remove a message's action buttons without Slack appending "edited"

查看:695
本文介绍了Slack:如何在不添加Slack的情况下删除消息的操作按钮?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一条带有动作按钮的Slackbot消息(请参见此处)。当用户单击按钮时,我们会在服务器上执行一些工作,然后使用聊天更新以删除操作按钮并更新邮件的页脚:

I have a Slackbot message that has action buttons (see here). When a user click's a button, we perform a bit of work on our server and then use chat.update to remove the action buttons and update the message's footer:

removeButtons(reply, convo, footer) {

  const data = reply.original_message;
  delete data.attachments[0].actions;
  data.channel = reply.channel;
  if (footer) {
    data.attachments[0].footer = footer;
  }
  this.bot.api.chat.update(data, (res) => {

  });
}

一切正常,但Slack在消息中附加了(已编辑) 。我看到很多其他应用程序都在做同样的事情,但是它们似乎避免使用(已编辑)文本?他们在做什么不同的事情?

Everything is working great but Slack appends an "(Edited)" to the message. I see a lot of other apps doing the same, but they seem to avoid the "(Edited)" text? What are they doing differently?

我尝试设置 as_user replace_original chat.update 调用中,但是没有运气。

I've tried setting as_user and replace_original in the chat.update call but haven't had any luck.

松弛截图

推荐答案

有两种方法可以通过交互来更新消息。

There are two ways to "update" a message as result of an interaction.


  1. 使用API​​方法 chat.update (如您所述)

  2. < a href = https://api.slack.com/interactive-messages#responding rel = nofollow noreferrer>直接用新消息响应到松弛请求

  1. Use the API method chat.update (as you described)
  2. Respond directly to the slack request with a new message

使用2),默认情况下将替换原始消息,并且不会有已编辑的注释。

With 2) the original message will be replaced by default and there will be no "edited" note.

这篇关于Slack:如何在不添加Slack的情况下删除消息的操作按钮?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆