Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

send a message in the first channel 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!`);
});
Comment

PREVIOUS NEXT
Code Example
Javascript :: console.log(number++); console.log(++number); console.log(number); 
Javascript :: Iterate Through the Keys of an Object with a for...in Statement 
Javascript :: javascript goto or redirect to page 
Javascript :: prevent the Confirm Form Resubmission dialog | window.history.back() confirm form resubmission 
Javascript :: react use last state 
Javascript :: NavBar with divs 
Javascript :: NextJs + Material UI, manually refreshing causes 
Javascript :: vue append component to div 
Javascript :: Backbone Notes Miscellaneous 
Javascript :: miragejs url parameters 
Javascript :: Backbone With Express 
Javascript :: Different Pages For Different Routes In Backbone 
Javascript :: iconbuttons onclick redirect to another page on react 
Javascript :: javascript count number of lines of a text 
Javascript :: react get variable from child component 
Javascript :: empty an array in javascript 
Javascript :: cookies javascript 
Javascript :: text inside image react native 
Javascript :: how to convert string into int js 
Javascript :: js delete url params 
Javascript :: how to set width 100 react native 
Javascript :: js pow function 
Javascript :: how to convert string to random case in javascript 
Javascript :: How to print even and odd position characters of an array of strings in JavaScript 
Javascript :: merge sort 
Javascript :: reading an array from python to js 
Javascript :: electron InitializeSandbox() called with multiple threads in process gpu-process. 
Javascript :: React ES6 Variables 
Javascript :: get data notifacation realtime use ajax good 
Javascript :: Javascripti functions accepting Flask parameters to display a PDF file with Adobe Embed API 
ADD CONTENT
Topic
Content
Source link
Name
1+3 =