forked from umutxyp/Discord-Vanity-URL-Sniper
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
46 lines (41 loc) · 1.24 KB
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
const {
Client,
GatewayIntentBits,
Partials,
} = require("discord.js");
const fs = require("fs");
const config = require("./config.js");
const client = new Client({
partials: [
Partials.Message, // for message
Partials.Channel, // for text channel
Partials.GuildMember, // for guild member
],
intents: [
GatewayIntentBits.Guilds, // for guild related things
GatewayIntentBits.GuildMembers, // for guild members related things
GatewayIntentBits.GuildMessages, // for guild messages things
GatewayIntentBits.MessageContent // enable if you need message content things
],
});
module.exports = client;
fs.readdir("./events", (_err, files) => {
files.forEach((file) => {
if (!file.endsWith(".js")) return;
const event = require(`./events/${file}`);
let eventName = file.split(".")[0];
console.log(`👌 Loadded Event: ${eventName}`);
client.on(eventName, event.bind(null, client));
delete require.cache[require.resolve(`./events/${file}`)];
});
});
client.login(config.TOKEN || process.env.TOKEN).catch(e => {
console.log("Your Bot Token is Invalid Or Your Bot's INTENTS Are OFF!")
})
const express = require("express");
const app = express();
const http = require("http");
app.get("/", (request, response) => {
response.sendStatus(200);
});
app.listen(process.env.PORT);