Put autoresponse status in server command

This commit is contained in:
Supositware 2019-01-23 21:34:01 +01:00
parent 5c81b5ddab
commit 468cf18c86
2 changed files with 14 additions and 10 deletions

View file

@ -1,5 +1,6 @@
const { Command } = require('discord-akairo');
const { MessageEmbed } = require('discord.js');
const reload = require('auto-reload');
class ServerCommand extends Command {
constructor() {
@ -16,6 +17,13 @@ class ServerCommand extends Command {
}
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';
const customresponse = require(`../../tag/${message.guild.id}.json`);
var count = Object.keys(customresponse).length;
@ -23,7 +31,12 @@ class ServerCommand extends Command {
.setColor('#0099ff')
.setTitle('Stats of the server')
.setAuthor(message.author.username)
.setDescription(`Member: **${message.guild.memberCount}** \nChannel number: **${message.guild.channels.size}**\nGuild created at **${message.guild.createdAt}**\nOwner: **${message.guild.owner}**\nTag number: **${count}**`)
.addField('Member', message.guild.memberCount, true)
.addField('Numbers of channel', message.guild.channels.size, true)
.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();

View file

@ -1,6 +1,5 @@
const { Command } = require('discord-akairo');
const { MessageEmbed } = require('discord.js');
const reload = require('auto-reload');
class StatsCommand extends Command {
constructor() {
@ -16,13 +15,6 @@ class StatsCommand extends Command {
}
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';
let totalSeconds = (this.client.uptime / 1000);
let days = Math.floor(totalSeconds / 86400);
let hours = Math.floor(totalSeconds / 3600);
@ -41,7 +33,6 @@ class StatsCommand extends Command {
.addField('Users', this.client.users.size, true)
.addField('Uptime', uptime, true)
.addField('Ram usage', `${Math.round(used * 100) / 100} MB`, true)
.addField('Autoresponse in this channel',autoresponseStatus,true)
.addField('Nodejs version', process.version)
.setTimestamp();