From 46ea45859510fbafc28f06572e0de68b8bcd0b7d Mon Sep 17 00:00:00 2001
From: loicbersier <loic.bersier1@gmail.com>
Date: Mon, 12 Aug 2019 14:18:45 +0200
Subject: [PATCH] a webhook per channel

---
 commands/fun/fakebot.js | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/commands/fun/fakebot.js b/commands/fun/fakebot.js
index 9fd3208b..896eef31 100644
--- a/commands/fun/fakebot.js
+++ b/commands/fun/fakebot.js
@@ -20,7 +20,7 @@ class fakebotCommand extends Command {
 					id: 'message',
 					type: 'string',
 					prompt: {
-						start: 'What message shoudl i send?',
+						start: 'What message should i send?',
 					},
 					match: 'rest',
 				}
@@ -34,10 +34,10 @@ class fakebotCommand extends Command {
 	}
 
 	async exec(message, args) {
-		if (!fs.existsSync(`./webhook/${message.guild.id}.json`)) {
+		if (fs.existsSync(`./webhook/${message.guild.id}_${message.channel.id}.json`)) {
 			message.channel.createWebhook('fakebot')
 				.then(webhook => {
-					fs.writeFile(`./webhook/${message.guild.id}.json`, `{"id": "${webhook.id}", "token": "${webhook.token}"}`, function (err) {
+					fs.writeFile(`./webhook/${message.guild.id}.json`, `{"id": "${webhook.id}", "token": "${webhook.token}", "channel": "${message.channel.id}"}`, function (err) {
 						if (err) {
 							console.log(err);
 						}
@@ -45,7 +45,7 @@ class fakebotCommand extends Command {
 					});
 				});
 		} else {
-			let webhook = reload(`../../webhook/${message.guild.id}.json`);
+			let webhook = reload(`./webhook/${message.guild.id}_${message.channel.id}.json`);
 			this.client.fetchWebhook(webhook.id, webhook.token)
 				.then(webhook => {
 					webhook.edit({