Haha-Yes/commands/utility/server.js

57 lines
1.7 KiB
JavaScript
Raw Normal View History

2018-12-30 01:20:24 +01:00
const { Command } = require('discord-akairo');
const { MessageEmbed } = require('discord.js');
const reload = require('auto-reload');
2018-12-25 19:17:07 +01:00
2018-12-30 01:20:24 +01:00
class ServerCommand extends Command {
2019-01-02 08:09:45 +01:00
constructor() {
super('server', {
aliases: ['server', 'serverinfo'],
category: 'utility',
channelRestriction: 'guild',
description: {
2018-12-30 01:20:24 +01:00
content: 'Show info about the server',
usage: '',
examples: ['']
}
2019-01-02 08:09:45 +01:00
});
}
2018-09-16 21:02:11 +02:00
2019-01-02 08:09:45 +01:00
async exec(message) {
const autoresponse = reload('../../json/autoresponse.json');
let autoresponseStatus;
if (autoresponse[message.channel.id] == undefined || autoresponse[message.channel.id] == 'disable')
autoresponseStatus = 'disabled';
else if (autoresponse[message.channel.id] == 'enable')
autoresponseStatus = 'enabled';
2019-02-08 18:46:00 +01:00
let count;
try {
const customresponse = require(`../../tag/${message.guild.id}.json`);
count = Object.keys(customresponse).length;
} catch (e) {
count = 0;
}
2019-01-02 08:09:45 +01:00
const addEmbed = new MessageEmbed()
.setColor('#0099ff')
.setTitle(message.guild.name)
2019-03-31 00:37:07 +01:00
.setThumbnail(message.guild.iconURL())
2019-06-20 22:33:59 +02:00
.addField('Numbers of users', message.guild.members.filter(member => !member.user.bot).size, true)
.addField('Numbers of bots', message.guild.members.filter(member => member.user.bot).size, true)
.addField('Total numbers of members', message.guild.memberCount, true)
.addField('Numbers of channel', message.guild.channels.size, true)
2019-06-20 22:33:59 +02:00
.addBlankField()
.addField('Date when guild created', message.guild.createdAt, true)
.addField('Owner', message.guild.owner, true)
.addField('Numbers of tag', count, true)
.addField('Autoresponse in this channel', autoresponseStatus, true)
.setTimestamp();
2019-01-02 08:09:45 +01:00
message.channel.send({ embed: addEmbed });
}
2018-12-30 01:20:24 +01:00
}
module.exports = ServerCommand;