0% found this document useful (0 votes)
212 views2 pages

Discord - Js Development

This document defines a Discord bot using the discord.js library. It creates a new Client instance that disables pings to everyone, loads environment variables from a .env file, sets the bot's presence to "watching me getting developed" when it comes online, logs all messages to the console, and logs the bot into Discord using a TOKEN environment variable.

Uploaded by

Alfonsus Mario
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
212 views2 pages

Discord - Js Development

This document defines a Discord bot using the discord.js library. It creates a new Client instance that disables pings to everyone, loads environment variables from a .env file, sets the bot's presence to "watching me getting developed" when it comes online, logs all messages to the console, and logs the bot into Discord using a TOKEN environment variable.

Uploaded by

Alfonsus Mario
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
You are on page 1/ 2

const { Client } = require("discord.

js");

const { config } = require("dotenv");

// Declares our bot,

// the disableEveryone prevents the client to ping @everyone

const client = new Client({

disableEveryone: true

});

config({

path: __dirname + "/.env"

})

// When the bot's online, what's in these brackets will be executed

client.on("ready", () => {

console.log(`Hi, ${client.user.username} is now online!`);

// Set the user presence

client.user.setPresence({

status: "online",

game: {

name: "me getting developed",

type: "WATCHING"

});
})

// When a message comes in, what's in these brackets will be executed

client.on("message", async message => {

console.log(`${message.author.username} said: ${message.content}`);

});

// Login the bot

client.login(process.env.TOKEN);

You might also like