const Command = require('../structures/Command');
const snekfetch = require('snekfetch');
const { inspect } = require('util');

class PostCommand extends Command {
	constructor() {
		super({
			name: 'post',
			description: 'Update the guild count on <https://bots.discord.pw>',
			ownersOnly: true
		});
	}

	async run(message, args) {
		const { config: { useDiscordBots, discordBotsAPI }, user, guilds, logger } = message.client;
		if (!useDiscordBots) return;
		snekfetch.post(`https://bots.discord.pw/api/bots/${user.id}/stats`)
		.set('Authorization', `${discordBotsAPI}`)
		.set('Content-type', 'application/json; charset=utf-8')
		.send(`{"server_count": ${guilds.size}}`)
		.then(res => message.reply('POST request sent successfully!'))
		.catch(err => {
			const errorDetails = `${err.host ? err.host : ''} ${err.text ? err.text : ''}`.trim();
			message.reply(`an error occurred updating the guild count: \`\`${err.status}: ${errorDetails}\`\``);
			logger.error(inspect(err));
		});
	}
}

module.exports = PostCommand;
@@ -760,98 +760,8 @@
 %3E %7B%0A
-%09%09%09const errorDetails = %60$%7Berr.host ? err.host : ''%7D $%7Berr.text ? err.text : ''%7D%60.trim();%0A
 %09%09%09m
@@ -838,16 +838,20 @@
 atus
+Code
 %7D: $%7Berr
 orDe
@@ -850,17 +850,19 @@
 %7Berr
-orDetails
+.statusText
 %7D%5C%60%5C
@@ -886,20 +886,78 @@
 ror(
-inspect(err)
+%60Error updating to DiscordBots: $%7Berr.statusCode%7D - $%7Berr.statusText%7D%60
 );%0A%09

Fix this logging n stuff