Move guild count into own function

This commit is contained in:
SileNce5k 2021-07-08 12:06:31 +02:00
parent c470b12f30
commit 855daefa4d
No known key found for this signature in database
GPG key ID: C507260E7F2583AD
2 changed files with 10 additions and 5 deletions

View file

@ -1,5 +1,6 @@
const Discord = require('discord.js'); const Discord = require('discord.js');
const getCreationDate = require('../util/getCreationDate'); const getCreationDate = require('../util/getCreationDate');
const getGuildCount = require('../util/getGuildCount');
@ -7,11 +8,7 @@ module.exports = {
name: 'botinfo', name: 'botinfo',
description: 'Shows information about the bot', description: 'Shows information about the bot',
execute({message, client, prefix}) { execute({message, client, prefix}) {
let guildCount = 0; let guildCount = getGuildCount(client)
client.guilds.cache.each(() => {
guildCount++
});
const embed = new Discord.MessageEmbed() const embed = new Discord.MessageEmbed()
.setColor(15780145) .setColor(15780145)
.setTitle("Information about bot") .setTitle("Information about bot")

8
util/getGuildCount.js Normal file
View file

@ -0,0 +1,8 @@
module.exports = function(client){
let guildCount = 0;
client.guilds.cache.each(() => {
guildCount++
});
return guildCount;
}