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;

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

    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
9+4 =