-
Notifications
You must be signed in to change notification settings - Fork 1
/
bot.js
118 lines (96 loc) · 4.52 KB
/
bot.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
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
/*
________.__ _____.___.___________
/ _____/| | _____ ____ ____ \__ | |\__ ___/
/ \ ___| | \__ \ _/ ___\/ __ \ / | | | |
\ \_\ \ |__/ __ \\ \__\ ___/ \____ | | |
\______ /____(____ /\___ >___ > / ______| |____|
\/ \/ \/ \/ \/
╔════════════════════════════════════════════════════════════════════════╗
║ ║
║ ## Created by GlaceYT! ║
║ ## Feel free to utilize any portion of the code ║
║ ## DISCORD : https://discord.com/invite/xQF9f9yUEM ║
║ ## YouTube : https://www.youtube.com/@GlaceYt ║
║ ║
╚════════════════════════════════════════════════════════════════════════╝
*/
const { Client, GatewayIntentBits } = require("discord.js");
const config = require("./config.js");
const fs = require("fs");
const path = require('path');
const { printWatermark } = require('./util/pw');
const { initializePlayer } = require('./player');
const client = new Client({
intents: Object.keys(GatewayIntentBits).map((a) => {
return GatewayIntentBits[a];
}),
});
client.config = config;
initializePlayer(client);
client.on("ready", () => {
console.log(`Logged in as ${client.user.tag}`);
client.riffy.init(client.user.id);
});
client.config = config;
fs.readdir("./events", (_err, files) => {
files.forEach((file) => {
if (!file.endsWith(".js")) return;
const event = require(`./events/${file}`);
let eventName = file.split(".")[0];
client.on(eventName, event.bind(null, client));
delete require.cache[require.resolve(`./events/${file}`)];
});
});
client.commands = [];
fs.readdir(config.commandsDir, (err, files) => {
if (err) throw err;
files.forEach(async (f) => {
try {
if (f.endsWith(".js")) {
let props = require(`${config.commandsDir}/${f}`);
client.commands.push({
name: props.name,
description: props.description,
options: props.options,
});
}
} catch (err) {
console.log(err);
}
});
});
client.on("raw", (d) => {
const { GatewayDispatchEvents } = require("discord.js");
if (![GatewayDispatchEvents.VoiceStateUpdate, GatewayDispatchEvents.VoiceServerUpdate].includes(d.t)) return;
client.riffy.updateVoiceState(d);
});
client.login(config.TOKEN || process.env.TOKEN).catch((e) => {
console.log('TOKEN ERROR❌ - Turn On Intents or Reset New Token');
});
const express = require("express");
const app = express();
const port = 3000;
app.get('/', (req, res) => {
const imagePath = path.join(__dirname, 'index.html');
res.sendFile(imagePath);
});
app.listen(port, () => {
console.log(`🔗 Listening to GlaceYT : http://localhost:${port}`);
});
printWatermark();
/*
________.__ _____.___.___________
/ _____/| | _____ ____ ____ \__ | |\__ ___/
/ \ ___| | \__ \ _/ ___\/ __ \ / | | | |
\ \_\ \ |__/ __ \\ \__\ ___/ \____ | | |
\______ /____(____ /\___ >___ > / ______| |____|
\/ \/ \/ \/ \/
╔════════════════════════════════════════════════════════════════════════╗
║ ║
║ ## Created by GlaceYT! ║
║ ## Feel free to utilize any portion of the code ║
║ ## DISCORD : https://discord.com/invite/xQF9f9yUEM ║
║ ## YouTube : https://www.youtube.com/@GlaceYt ║
║ ║
╚════════════════════════════════════════════════════════════════════════╝
*/