问题
I want to make a command that sends the text to a channel of my choosing.
Example:
!command "text"
Then the "text" is sent to the channel I chose.
回答1:
That's the same code from this thread, I just modified a little part as I told you in the comments.
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");
});
来源:https://stackoverflow.com/questions/51753661/command-to-send-text-to-a-specific-channel