Skip to content Skip to sidebar Skip to footer

Command To Send Text To A Specific Channel

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.

Solution 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");
});

Post a Comment for "Command To Send Text To A Specific Channel"