List of guilds bot is in – Code snippet

List of guilds bot is in – Code snippet

So, using Discord.js and Node.js have you wondered what guilds your bot is in?
If so, the this little snippet might interest you:

if ( != 'YOUR_USERID_HERE') {
    message.client.channels.cache.get('CHANNEL_ID').send(`${} tried to ask what guilds I'm in!`);`This function is reserved for the bots owner!`);
} else {
    let sicon = message.guild.iconURL();
    let guilds = =>
    let guildEmbed = new Discord.MessageEmbed()
        .setDescription("I can be found in the following guilds:")
        .addField('Guilds:', guilds);

Replace YOUR_USERID_HERE with your own user id, and CHANNEL_ID with the ID of your logchannel (if you have one). If not, then comment out or remove this line.
This will list every guild your bot is in, and only for you! If someone else wants to use it, they simply get the message : Reserved for bot owner!

I will be posting snippets and maybe also complete codes for functions and/or games I create. For now, it’s just snippets like this one.
I have also implemented the KICK and BAN functions in my bot CodeLog, so this is now Live!

Leave a Reply

Your email address will not be published. Required fields are marked *