Way to check if a channel exists

后端 未结 3 1242
迷失自我
迷失自我 2021-01-24 22:24
module.exports.run = async (bot, message, args) => {

    let ticketreason = args[1];
    let ticketname = \"ticket\" + ticketreason;

    message.guild.createChannel         


        
3条回答
  •  不思量自难忘°
    2021-01-24 22:54

    I do it in the following way, and I go through each of the channels.

    let nameOfChannel = "lista-" + message.author.username.toLowerCase();
    
            // Check if channel exist
            if ((message.guild.channels.cache.find(c => c.name.toLowerCase() === nameOfChannel))) {
    
    ---- code continue here----
    
    

提交回复
热议问题