From abaaa67d23ce85f560627e9802ac19b285303cde Mon Sep 17 00:00:00 2001 From: Supositware Date: Thu, 11 Apr 2019 18:17:44 +0200 Subject: [PATCH] Replaced hardcodded ID whith BotID from config.json and added fetch message thing ( not in use ) --- event/listeners/ready.js | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/event/listeners/ready.js b/event/listeners/ready.js index 673f9b8a..965794ea 100644 --- a/event/listeners/ready.js +++ b/event/listeners/ready.js @@ -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)); + } + } + */ } }