-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbot.js
72 lines (63 loc) · 1.75 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
const { CommandoClient } = require('discord.js-commando');
const { Structures } = require('discord.js');
const path = require('path');
const logger = require('winston');
const { prefix, token } = require('./config.json');
// Configure logger settings
logger.remove(logger.transports.Console);
logger.add(new logger.transports.Console, {
// eslint-disable-next-line comma-dangle
colorize: true
});
logger.level = 'debug';
Structures.extend('Guild', Guild => {
class MusicGuild extends Guild {
constructor(client, data) {
super(client, data);
this.musicData = {
queue: [],
isPlaying: false,
nowPlaying: null,
songDispatcher: null
};
/* this.triviaData = {
isTriviaRunning: false,
wasTriviaEndCalled: false,
triviaQueue: [],
triviaScore: new Map()
}; */
}
}
return MusicGuild;
});
const client = new CommandoClient({
commandPrefix: prefix,
owner: '239622381788856321',
invite: 'https://discord.gg/K3GPhgV',
});
client.on('ready', function() {
logger.info('Connected');
logger.info('Logged in as: ');
logger.info(client.user.tag + ' - (' + client.user.username + ')');
client.user.setActivity('with Javascript');
});
client.registry
.registerDefaultTypes()
.registerGroups([
['test', 'Test Command Group'],
['music', 'Music'],
['other', 'Random types of commands'],
])
.registerDefaultGroups()
.registerDefaultCommands()
.registerCommandsIn(path.join(__dirname, 'commands'));
client.once('ready', () => {
console.log(`Logged in as ${client.user.tag}! (${client.user.id})`);
});
client.on('guildMemberAdd', member => {
const channel = member.guild.channels.find(c => c.name === 'general');
if (!channel) return;
channel.send(`Welcome ${member}!`);
});
client.on('error', console.error);
client.login(token);