From 468cf18c863a5887b36c2060435a5457e6a84850 Mon Sep 17 00:00:00 2001 From: Supositware Date: Wed, 23 Jan 2019 21:34:01 +0100 Subject: [PATCH] Put autoresponse status in server command --- commands/utility/server.js | 15 ++++++++++++++- commands/utility/stats.js | 9 --------- 2 files changed, 14 insertions(+), 10 deletions(-) diff --git a/commands/utility/server.js b/commands/utility/server.js index 9c7658a..d3a39fb 100644 --- a/commands/utility/server.js +++ b/commands/utility/server.js @@ -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(); diff --git a/commands/utility/stats.js b/commands/utility/stats.js index b1d3147..6cd1011 100644 --- a/commands/utility/stats.js +++ b/commands/utility/stats.js @@ -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();