我想制作一个命令,将文本发送到我选择的 channel 。
示例:
!command "text"
然后“文本”
被发送到我选择的 channel 。
最佳答案
这与 this thread 中的代码相同,我只是修改了一小部分,就像我在评论中告诉你的那样。
client.on('message', msg => {
if (msg.guild && msg.content.startsWith('/log')) {
let text = msg.content.slice('/log'.length); // cuts off the /log part
let channel = msg.guild.channels.find('name', 'channel_name_here');
if (channel) channel.send(text);
else msg.reply("Can't find channel");
});
关于javascript - 将文本发送到特定 channel 的命令,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51753661/