-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
46 lines (41 loc) · 1.11 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
console.log('booting...');
// BOT CODE
const Discord = require('discord.js');
const handler = require('./handler');
const randomarray = require('./commands/functions/randomarray');
const client = new Discord.Client({ intents: ['GUILDS', 'GUILD_MESSAGES'] });
require('dotenv').config();
const activities = [
'Medal.tv',
'on Google',
'in the developer console',
'discord.js',
'discord.js for fun',
'Roblox',
'Minecraft',
'in the console',
'with no one',
];
client.on('ready', async () => {
try {
setInterval(() => {
const index = randomarray(activities);
client.user.setActivity(index);
},
10000,
);
} catch (err) {
console.error(`${err}\n\nGoing to a fixed status!`);
client.user.setActivity('discord.js');
}
console.log('ready for use');
});
client.on('shardError', error => {
console.error('A websocket connection encountered an error:', error);
});
client.on('unhandledRejection', error => {
console.error('Unhandled promise rejection:', error);
});
client.on('messageCreate', handler);
console.log('finished checking');
client.login(process.env.TOKEN);