Way to check if a channel exists

后端 未结 3 1243
迷失自我
迷失自我 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:46

    You can do this by checking for the id. While this might not resolve this particular issue, it might help others with a similar issue.:

    
    var chan_id;
    
    if(message.guild.channels.cache.get(chan_id) === undefined)  { 
        //checks if the channel doesn't exist
        //put the action to take here
    } 
    //continue your code here
    

提交回复
热议问题