Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

how to find default or the first server discord.js

const Discord = require('discord.js');
const bot = new Discord.Client();

bot.on("guildCreate", guild => {
    let channelID;
    let channels = guild.channels.cache;

    for (let key in channels) {
        let c = channels[key];
        if (c.type === "text") {
            channelID = c.id;
            break;
        }
    }

    let channel = guild.channels.cache.get(guild.systemChannelID || channelID);
    channel.send(`Thanks for inviting me into this server!`);
});
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #find #default #server
ADD COMMENT
Topic
Name
8+6 =