- Java 双重比较
- java - 比较器与 Apache BeanComparator
- Objective-C 完成 block 导致额外的方法调用?
- database - RESTful URI 是否应该公开数据库主键?
我正在使用 slack slash commands API ,到目前为止,它与我的机器人 (https://github.com/jesseditson/slashbot) 配合得很好,除了一件事:
在其他斜杠集成(例如 giphy)中,当用户键入斜杠命令时,该命令会输出到公共(public)聊天室,然后发布响应:
(来源:pxfx.io)
但是当我使用自定义斜杠命令时,根本没有输出原始命令:
(来源:pxfx.io)
我目前正在使用 Incoming Webhooks用于将消息发布回 channel 的 API,它工作正常,但没有原始请求,响应是无形的并且缺乏上下文。
/command
这似乎可以通过 giphy 用于集成的任何东西来实现,这给我留下了一些问题:
giphy 使用的是私有(private) API,还是我错过了模拟此行为的正确 API?
我是否错过了允许此操作的设置?
我正在使用 node.js,但除了语言之外,我更感兴趣的是这是否可行。
作为旁注,我意识到我可以使用 Bot API或 Real Time Messaging API实现类似的东西,但没有斜杠 - 但是,我真的很喜欢斜杠命令附带的文档选项和自动完成功能,所以这就是我对这个问题的追求。
最佳答案
来自 Slack 的/Command API 文档:
In Channel" vs "Ephemeral" responses
By default, the response messages sent to commands will only be visible to the user that issued the command (we call these "ephemeral" messages). However, if you would like the response to be visible to all members of the channel in which the user typed the command, you can add a
response_type
ofin_channel
to the JSON response, like this:
{
“response_type”:“in_channel”,
"text": "现在是 80 度。",
“附件”:[
{
"text":"今明两天多云"
}
]
}
我认为您需要将 response_type
设置为 "in_channel"
以允许其他用户看到响应。
关于node.js - 松弛斜杠命令 - 显示用户输入的文本?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31597985/
我是一名优秀的程序员,十分优秀!