Replaced hardcodded ID whith BotID from config.json and added fetch message thing ( not in use )

This commit is contained in:
Supositware 2019-04-11 18:17:44 +02:00
parent cf730ccda4
commit abaaa67d23

View file

@ -1,5 +1,5 @@
const { Listener } = require('discord-akairo');
const { prefix, statsChannel } = require('../../config.json');
const { prefix, statsChannel, botID } = require('../../config.json');
const game = require('../../json/status/playing.json');
const watch = require('../../json/status/watching.json');
@ -33,12 +33,28 @@ class ReadyListener extends Listener {
this.client.user.setActivity(`${status} | ${prefix[0]} help`, { type: 'PLAYING' });
}
// 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 == botID) {
const channel = this.client.channels.get(statsChannel);
channel.send(`Ready to serve in ${this.client.channels.size} channels on ${this.client.guilds.size} servers, for a total of ${this.client.users.size} users. ${this.client.readyAt}`);
}
/*
//Fetch messages in every channel ( so they can still enter starboard in case of reboot)
let array = [];
let channels = this.client.channels.array();
for (const channel of channels.values()) {
array.push(channel.id);
}
for (let i = 0; i < this.client.channels.size; i++) {
let channel = this.client.channels.get(array[i]);
if (channel.messages) {
channel.messages.fetch({ limit: 10 })
.then(messages => console.log(`Received ${messages.size} messages`))
.catch(err => console.error(err));
}
}
*/
}
}