-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.js
108 lines (74 loc) · 2.45 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
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
// NPM imports
const fs = require('fs');
const Discord = require('discord.js');
const client = new Discord.Client({ autoReconnect: true });
// My Imports
const { token, prefix, version, mainColor } = require('./config/settings');
const { commandsEmbed } = require('./settings/embedCmd')
// When the bot is ready
client.once('ready', () => {
let time = new Date();
console.log(`Logged in as ${client.user.tag} on ${time}!`);
// Start MP3 downloader
// Start Memes soundboard
// Start youtube listener
});
client.on('message', async message => {
// If bot then gtfo
if (message.author.bot) return;
// If the bot is tagged by an user
if (message.content.includes(client.user.toString())) {
// commandsEmbed returns the embed json format + picture in settings/embedCmd.js
// message.channel.send(await commandsEmbed())
// Test send center shit
var center = require('center-align');
message.channel.send(`\`${center('foo', 12)}\``)
}
if (message.content.startsWith(prefix)){
// First check on prefix
const args = message.content.slice(prefix.length).trim().split(' ');
const cmd = args.shift().toLowerCase();
let commandFile = require('./commands/' + cmd + '.js');
let config = {
prefix: prefix,
mainColor: mainColor,
version: version
}
return commandFile.run(client, message, args, config);
}
})
client.login(token);
// client.on('ready', () => {
// let time = new Date();
// console.log(`Logged in as ${client.user.tag} on ${time}!`);
// });
// client.on('message', message => {
// if (message.content === '!play') {
// // Note that this will only work if the message was sent in a guild
// // and the author is actually in a voice channel.
// // You might want to check for all that stuff first
// const channel = message.member.voice.channel;
// channel.join()
// .then(connection => console.log('Connected!'))
// .catch(console.error);
// }
// });
client.on('message', msg => {
msg.member.voice.channel.join().then(connection => {
console.log('play');
setInterval(() => {
connection.play('./sounds/oi.mp3');
}, 500);
// while(true){
// }
// dispatcher.on('end', () => {
// console.log(dispatcher.time);
// msg.member.voice.channel.leave()
// });
// dispatcher.on('error', e => {
// console.log('e');
// msg.member.voiceChannel.leave()
// });
});
});
// client.login(token);