forked from Galactic/galactic-bot
blargus
This commit is contained in:
parent
8ae1e757eb
commit
7a06e8c32e
@ -63,13 +63,13 @@ class DiscordClient extends Client {
|
||||
|
||||
this._loadEevents();
|
||||
|
||||
process.on('uncaughtException', (err) => {
|
||||
this.logger.error(`Uncaught exception:\n${err.stack || err}`);
|
||||
});
|
||||
// process.on('uncaughtException', (err) => {
|
||||
// this.logger.error(`Uncaught exception:\n${err.stack || err}`);
|
||||
// });
|
||||
|
||||
process.on('unhandledRejection', (err) => {
|
||||
this.logger.error(`Unhandled rejection:\n${err.stack || err}`);
|
||||
});
|
||||
// process.on('unhandledRejection', (err) => {
|
||||
// this.logger.error(`Unhandled rejection:\n${err.stack || err}`);
|
||||
// });
|
||||
|
||||
}
|
||||
|
||||
@ -101,6 +101,11 @@ class DiscordClient extends Client {
|
||||
await super.login();
|
||||
await ready;
|
||||
|
||||
this._setActivity();
|
||||
this._activityInterval = setInterval(() => {
|
||||
this._setActivity();
|
||||
}, 1800_000); // 30 min
|
||||
|
||||
return this;
|
||||
|
||||
}
|
||||
@ -144,15 +149,15 @@ class DiscordClient extends Client {
|
||||
async _setActivity() {
|
||||
const activities = {
|
||||
0: async () => {
|
||||
const guildCount = (await this.shard.broadcastEval('this.guilds.cache.size')).reduce((p, v) => p+v, 0);
|
||||
const guildCount = (await this.shard.broadcastEval((client) => client.guilds.cache.size)).reduce((p, v) => p+v, 0);
|
||||
this.user.setActivity(`${guildCount} servers`, { type: 'WATCHING' });
|
||||
},
|
||||
1: async () => {
|
||||
const userCount = (await this.shard.broadcastEval('this.users.cache.size')).reduce((p, v) => p+v, 0);
|
||||
const userCount = (await this.shard.broadcastEval((client) => client.users.cache.size)).reduce((p, v) => p+v, 0);
|
||||
this.user.setActivity(`to ${userCount} users`, { type: 'LISTENING' });
|
||||
},
|
||||
2: async () => {
|
||||
this.user.setActivity("to /help", { type: 'LISTENING' });
|
||||
this.user.setActivity("for /help", { type: 'LISTENING' });
|
||||
}
|
||||
};
|
||||
|
||||
@ -254,6 +259,7 @@ class DiscordClient extends Client {
|
||||
|
||||
}
|
||||
|
||||
|
||||
get prefix() {
|
||||
return this._options.discord.prefix;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user