Haha-Yes/commands/utility/server.js
supositware dfd25c8bf2 Bunch of update
mostly replacing message.channel.send with message.reply
( i hope it work this time... )
2021-07-23 04:19:47 +02:00

43 lines
1.4 KiB
JavaScript
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

const { Command } = require('discord-akairo');
const LogStats = require('../../models/').LogStats;
class ServerCommand extends Command {
constructor() {
super('server', {
aliases: ['server', 'serverinfo'],
category: 'utility',
clientPermissions: ['SEND_MESSAGES', 'EMBED_LINKS'],
channel: 'guild',
description: {
content: 'Show info about the server',
usage: '',
examples: ['']
}
});
}
async exec(message) {
let botCount = message.guild.members.cache.filter(member => member.user.bot).size;
const addEmbed = this.client.util.embed()
.setColor(message.member ? message.member.displayHexColor : 'NAVY')
.setTitle(message.guild.name)
.setThumbnail(message.guild.iconURL())
.addField('Number of users', message.guild.memberCount - botCount, true)
.addField('Number of bots', botCount, true)
.addField('Total number of members', message.guild.memberCount, true)
.addField('Number of channels', message.guild.channels.cache.size, true)
.addField('', '')
.addField('Date when guild created', message.guild.createdAt, true)
.addField('Owner', message.guild.owner, true)
.setTimestamp();
const logStats = await LogStats.findOne({where: {guild: message.guild.id}});
if (logStats) addEmbed.addField('Logging', 'On ✅');
else addEmbed.addField('Logging', 'Off ❌');
message.reply({ embed: addEmbed });
}
}
module.exports = ServerCommand;