【发布时间】:2019-05-02 03:50:52
【问题描述】:
使用 Discord.io,我试图将消息发送到与发送消息不同的频道,但经过大量谷歌搜索和试验后,我似乎仍然找不到这样做的方法。
我尝试简单地将 channelID 更改为我希望它发送到的频道并将 channelID 覆盖到我希望它发送到的频道,但没有成功
例如:
bot.on('message', function (user, userID, channelID, message, evt) {
if (message.substring(0, 1) == '!') {
var args = message.substring(1).split(' ');
var cmd = args[0].toLowerCase();
args = args.splice(1);
switch(cmd) {
case 'test':
bot.sendMessage({
to: // channel id here,
message: 'If all went well this got sent in another channel'
});
break;
default:
bot.sendMessage({
to: channelID,
message: 'I wasn\'t able to understand this command, please try again...'
});
break;
}
}
});
希望你能帮助我。 如果您有不清楚的地方,请随时提问。
提前致谢。
【问题讨论】:
-
您能否确认默认情况下工作成功,向机器人正在侦听的频道发送消息?您能否出示用于获取您希望向其发送消息的其他频道的频道 ID 的代码?
-
@ConspicuousCompiler 我已经解决了这个问题,但仍然感谢您尝试帮助我。它还不允许我将其设置为解决方案(等待 2 天?),但会在可能的情况下这样做
标签: javascript node.js discord.io