-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathready.js
42 lines (35 loc) · 1.05 KB
/
ready.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
const { EmbedBuilder, Client, Events } = require('discord.js');
module.exports = {
name: Events.ClientReady,
/**
* @param {Client} client
* @param {Client} _client
*/
async execute(client, _client) {
// prevent internals to perform actions on invalid data
await require('../utils/initialize_db')(client);
console.log(`${client.user.tag} is up and ready to go!`);
// Set presence
//
// This only needs to be ran once on startup,
// to avoid having multiple intervals changing presence.
function *presenceGen() {
let presenceList = [
{ status: "boopy cry", type: "WATCHING" },
];
let i = 0;
while(true) {
yield presenceList[i];
if(i == (presenceList.length - 1)) { i = 0; }
else { i++; }
}
}
const presences = presenceGen();
const firstActivity = presences.next().value;
client.user.setActivity(firstActivity.status, { type: firstActivity.type });
setInterval(() => {
const activity = presences.next().value;
client.user.setActivity(activity.status, { type: activity.type });
}, 20000);
}
};