问题描述
使用 Serverless 和 NodeJS,我设置了一个 Slack 命令,如下所示:
Using Serverless and NodeJS, I have a Slack command set up like:
/myCommand doStuff
当我输入 /myCommand doStuff
时,Slack 输出会这样做:
When I type /myCommand doStuff
, the Slack output does this:
/myCommand doStuff
我想要显示的实际响应的内容在这里.
The content of the actual response I want shown goes here.
我想做的只有这个:
我想要显示的实际响应的内容在这里.
没有 /myCommand doStuff
得到回显.
我如何防止这种情况发生?
How do I prevent that from happening?
实际命令如下:
module.exports = () => {
return new Promise(function(fulfill) {
fulfill({
response_type: 'in_channel',
text: 'some testing text
});
});
};
这是处理程序:
module.exports.handler = (event, context, callback) => {
var response = {
statusCode: 200,
body: JSON.stringify(myCommand()),
};
callback(null, response);
};
推荐答案
回复时
"response_type": "in_channel"
频道中的所有用户都可以看到回复,并且它会始终将命令复制回频道.此功能无法关闭.
the reply is visible to all users in a channel and it will always copy the command back into the channel. This can not be turned off.
回复时
"response_type": "ephemeral"
它只对用户可见,命令不会被复制回来.这也是默认设置,因此您必须在脚本中使用 in_channel
.
it is only visible to the user and the command will not be copied back. That is also the default, so you must be using in_channel
in your script.
有关该主题的官方文档,请参阅此处.
See here for the official documentation on that topic.
这篇关于如何防止我的 Slack 斜杠命令回显到通道中?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!