-
Notifications
You must be signed in to change notification settings - Fork 1
/
index.js
62 lines (54 loc) · 1.82 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
const { Client, Collection } = require("discord.js")
const { createAudioPlayer, NoSubscriberBehavior } = require("@discordjs/voice")
const fs = require('fs')
const { token, mongo_srv } = require('./config.json')
const Logger = require('./utils/logger')
const c = new Logger()
const mongoose = require('mongoose')
const client = new Client({
presence: {
status: 'online',
afk: false,
activities: [{
name: 'deez nuts',
type: 'COMPETING'
}],
},
intents: 32767
})
const express = require('express');
const app = express();
const port = 3000;
client.commands = new Collection();
client.snipes = new Collection();
client.testCommands = new Collection();
const handlers = fs.readdirSync("./handlers").filter(file => file.endsWith(".js"));
const eventFiles = fs.readdirSync("./events").filter(file => file.endsWith(".js"));
const commandFolder = fs.readdirSync("./commands")
app.get('/', (req, res) => res.send('bot is working'));
app.listen(port, () => c.info(`Your app is listening at http://localhost:${port}`, __filename));
/* VOICE */
client.player = createAudioPlayer({
behaviors: {
noSubscriber: NoSubscriberBehavior.Play
}
});
(async () => {
mongoose.connect(mongo_srv, {
useNewUrlParser: true,
useUnifiedTopology: true
}).then(() => c.info('Connected to the database', __filename)).catch(err => c.error(err, __filename));
for (file of handlers) {
require(`./handlers/${file}`)(client);
}
client.handleEvents(eventFiles, './events')
client.handleCommands(commandFolder, './commands')
client.login(token)
})();
client.player.on('stateChange', (oldState, newState) => {
if (oldState == 'idle') {
c.raw('test', __filename)
} else if (newState == 'playing') {
c.raw('testplay', __filename)
}
})