【发布时间】:2020-12-18 01:08:34
【问题描述】:
我想做这样的机器人命令:
我在聊天中写:~msg (Text) (Channel),然后机器人会发送一条消息,例如:Hello everyone. (In channel General)。
这是我目前使用的代码:
switch (args[0]) {
case 'msg':
if (!args[1]) return message.channel.send('Fill the channel name')
if (!args[2]) return message.channel.send('Fill the text')
message.client.channels.cache.find(channel => channel.name === args[1]).send(args[2]);
}
})
【问题讨论】:
标签: javascript node.js discord discord.js