Search code examples
embeddiscord.js

Change Channel name with a command and also send embed with it


I'm making a discord bot which it will change the specifc name of the channel

Code

if(command === `${prefix}openslot`) {

    let embed = new Discord.RichEmbed()
        .setColor("#1bc643")
        .setTitle("Sucessfully opened slot for PREMIUM RANK!")
        .addField("Created At", message.author.createdAt)

        .setDescription("SYSTEM");

    message.channel.sendMessage(embed);
    channel.setName('Reserved_Slot')

.then(newChannel => console.log(Channel's new name is ${newChannel.name})) .catch(console.error);

    return;
}

And also I'm new to discord.js (started a month ago)


Solution

  • Never-mind, I found it myself.

    message.guild.channels.find("name", "general").setName("Testing");
    

    Thanks for correcting my grammar.