-
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathindex.js
90 lines (78 loc) · 2.51 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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
const {
Client,
GatewayIntentBits,
Partials,
Collection,
} = require("discord.js");
const { DisTube } = require("distube");
const { SpotifyPlugin } = require('@distube/spotify');
const { SoundCloudPlugin } = require('@distube/soundcloud');
const { YtDlpPlugin } = require('@distube/yt-dlp');
const { handleLogs } = require('./Handlers/handleLogs');
const logs = require('discord-logs');
const { loadEvents } = require("./Handlers/eventHandler");
const { loadCommands } = require("./Handlers/commandHandler");
const { loadModals } = require("./Handlers/modalHandler");
const { loadButtons } = require("./Handlers/buttonHandler");
const { LoadErrorHandler } = require("./Handlers/ErrorHandler");
const { loadComponents } = require('./Handlers/ComponentsHandler');
const client = new Client({
intents: [Object.keys(GatewayIntentBits)],
partials: [Object.keys(Partials)],
});
// adding no prefix sytem type help in your discord server
const client = new Client({
intents: [Object.keys(GatewayIntentBits)],
partials: [Object.keys(Partials)],
});
client.on('messageCreate', async (message) => {
if (message.author.bot) return; // Ignore messages sent by bots
if (message.content === 'help') { // Trigger command when the message is 'hello'
await message.reply('just ***/help*** command To open my drop down menu'); // Respond with a message
}
});
//end//
//nodejs-events
process.on("unhandledRejection", e => {
console.log(e)
})
process.on("uncaughtException", e => {
console.log(e)
})
process.on("uncaughtExceptionMonitor", e => {
console.log(e)
})
//
client.distube = new DisTube(client, {
emitNewSongOnly: true,
leaveOnFinish: true, // you can change this to your needs
emitAddSongWhenCreatingQueue: false,
plugins: [new SpotifyPlugin()]
});
client.config = require("./config.json");
logs(client, {
debug: true,
});
client.giveawayConfig = require("./config.js");
client.commands = new Collection();
client.subCommands = new Collection(); //sub commands
client.modals = new Collection();
client.buttons = new Collection();
client.errors = new Collection();
['giveawaysEventsHandler', 'giveawaysManager'].forEach((x) => {
require(`./Utils/${x}`)(client);
})
module.exports = client;
client.login(process.env.token).then(() => {
loadEvents(client);
loadCommands(client);
});
//keep-alive//
const express = require('express');
const app = express();
const port = 3000 || 8080;
app.all('/', (req, res) => {
// res.setHeader('Content-Type', 'text/html');
res.send(`24/7 KeepAlive Server is online!`);
res.end();
});