Skip to content

Commit 0908fde

Browse files
Create index.js
1 parent c80c007 commit 0908fde

File tree

1 file changed

+34
-0
lines changed

1 file changed

+34
-0
lines changed

Ep_01/index.js

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
const { Client } = require("discord.js");
2+
const { config } = require("dotenv");
3+
4+
// Declares our bot,
5+
// the disableEveryone prevents the client to ping @everyone
6+
const client = new Client({
7+
disableEveryone: true
8+
});
9+
10+
config({
11+
path: __dirname + "/.env"
12+
})
13+
14+
// When the bot's online, what's in these brackets will be executed
15+
client.on("ready", () => {
16+
console.log(`Hi, ${client.user.username} is now online!`);
17+
18+
// Set the user presence
19+
client.user.setPresence({
20+
status: "online",
21+
game: {
22+
name: "me getting developed",
23+
type: "WATCHING"
24+
}
25+
});
26+
})
27+
28+
// When a message comes in, what's in these brackets will be executed
29+
client.on("message", async message => {
30+
console.log(`${message.author.username} said: ${message.content}`);
31+
});
32+
33+
// Login the bot
34+
client.login(process.env.TOKEN);

0 commit comments

Comments
 (0)