来自机器人的 Slack 更改主题 post
Slack change theme from bot post
我有一个具有以下代码的机器人:
bot.on('message', function (data) {
// all ingoing events https://api.slack.com/rtm
console.log(data);
if (data.content.includes('new')) {
bot.postMessageToUser(data.subtitle, '#282828 ,#565656 ,#2AFC86 ,#282828 ,#434745 ,#FFFFFF ,#2AFC8e ,#DB6668 ');
} else {
bot.postMessageToUser(data.subtitle, 'I don\'t understand :scream_cat:\nPlease type "new" for a new color scheme.');
}
});
当我post配色方案时,它看起来像这样:
然而,当机器人 post 完全相同时,它看起来像这样:
我post时的方式就是想要的结果。有什么方法可以让它发挥作用吗?
只需添加 {as_user: true}
作为搜索参数参数:
bot.on('message', function (data) {
// all ingoing events https://api.slack.com/rtm
console.log(data);
if (data.content.includes('new')) {
bot.postMessageToUser(data.subtitle, '#282828 ,#565656 ,#2AFC86 ,#282828 ,#434745 ,#FFFFFF ,#2AFC8e ,#DB6668 ', {as_user: true});
} else {
bot.postMessageToUser(data.subtitle, 'I don\'t understand :scream_cat:\nPlease type "new" for a new color scheme.', {as_user: true});
}
});
我有一个具有以下代码的机器人:
bot.on('message', function (data) {
// all ingoing events https://api.slack.com/rtm
console.log(data);
if (data.content.includes('new')) {
bot.postMessageToUser(data.subtitle, '#282828 ,#565656 ,#2AFC86 ,#282828 ,#434745 ,#FFFFFF ,#2AFC8e ,#DB6668 ');
} else {
bot.postMessageToUser(data.subtitle, 'I don\'t understand :scream_cat:\nPlease type "new" for a new color scheme.');
}
});
当我post配色方案时,它看起来像这样:
然而,当机器人 post 完全相同时,它看起来像这样:
我post时的方式就是想要的结果。有什么方法可以让它发挥作用吗?
只需添加 {as_user: true}
作为搜索参数参数:
bot.on('message', function (data) {
// all ingoing events https://api.slack.com/rtm
console.log(data);
if (data.content.includes('new')) {
bot.postMessageToUser(data.subtitle, '#282828 ,#565656 ,#2AFC86 ,#282828 ,#434745 ,#FFFFFF ,#2AFC8e ,#DB6668 ', {as_user: true});
} else {
bot.postMessageToUser(data.subtitle, 'I don\'t understand :scream_cat:\nPlease type "new" for a new color scheme.', {as_user: true});
}
});