将文本发送到特定频道的命令
Command to send text to a specific channel
我想创建一个命令,将文本发送到我选择的频道。
示例:
!command "text"
然后"text"
发送到我选择的频道
这与 中的代码相同,我只是修改了一小部分,就像我在评论中告诉你的那样。
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");
});
我想创建一个命令,将文本发送到我选择的频道。
示例:
!command "text"
然后"text"
发送到我选择的频道
这与
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");
});