Choose between playing and watching status at random on start

This commit is contained in:
Supositware 2019-03-23 19:28:57 +01:00
parent d24c6c68f7
commit a1b712a13d

View file

@ -1,6 +1,7 @@
const { Listener } = require('discord-akairo'); const { Listener } = require('discord-akairo');
const { prefix, statsChannel } = require('../../config.json'); const { prefix, statsChannel } = require('../../config.json');
const game = require('../../json/status/playing.json');
const watch = require('../../json/status/watching.json');
class ReadyListener extends Listener { class ReadyListener extends Listener {
constructor() { constructor() {
@ -15,8 +16,23 @@ class ReadyListener extends Listener {
console.log(`\x1b[32mLogged in as \x1b[34m${this.client.user.tag}\x1b[0m! (\x1b[33m${this.client.user.id}\x1b[0m)`); console.log(`\x1b[32mLogged in as \x1b[34m${this.client.user.tag}\x1b[0m! (\x1b[33m${this.client.user.id}\x1b[0m)`);
console.log(`Ready to serve in \x1b[33m${this.client.channels.size}\x1b[0m channels on \x1b[33m${this.client.guilds.size}\x1b[0m servers, for a total of \x1b[33m${this.client.users.size}\x1b[0m users. \x1b${this.client.readyAt}\x1b[0m`); console.log(`Ready to serve in \x1b[33m${this.client.channels.size}\x1b[0m channels on \x1b[33m${this.client.guilds.size}\x1b[0m servers, for a total of \x1b[33m${this.client.users.size}\x1b[0m users. \x1b${this.client.readyAt}\x1b[0m`);
//Bot activity //Bot status
this.client.user.setActivity(`${prefix} feedback <feedback> to tell me what you think of the bot! | ${prefix} help`); if (Math.floor((Math.random() * 2) + 1) == 1) {
console.log('Status type: Watching');
let status = watch[Math.floor((Math.random() * watch.length))];
status = status.replace('${prefix}', prefix);
this.client.user.setActivity(`${status} | ${prefix} help`, { type: 'WATCHING' });
} else {
console.log('Status type: Playing');
let status = game[Math.floor((Math.random() * game.length))];
status = status.replace('${prefix}', prefix);
this.client.user.setActivity(`${status} | ${prefix} help`, { type: 'PLAYING' });
}
// Send stats to the 'stats' channel in the support server if its not the test bot // Send stats to the 'stats' channel in the support server if its not the test bot
if (this.client.user.id == 377563711927484418) { if (this.client.user.id == 377563711927484418) {