reload the json

This commit is contained in:
loicbersier 2019-08-12 14:08:06 +02:00
parent 4ab1eb3a2d
commit c940aa8d3e

View file

@ -1,5 +1,6 @@
const { Command } = require('discord-akairo'); const { Command } = require('discord-akairo');
const fs = require('fs'); const fs = require('fs');
const reload = require('auto-reload');
class fakebotCommand extends Command { class fakebotCommand extends Command {
constructor() { constructor() {
@ -44,7 +45,7 @@ class fakebotCommand extends Command {
}); });
}); });
} else { } else {
let webhook = require(`../../webhook/${message.guild.id}.json`); let webhook = reload(`../../webhook/${message.guild.id}.json`);
this.client.fetchWebhook(webhook.id, webhook.token) this.client.fetchWebhook(webhook.id, webhook.token)
.then(webhook => { .then(webhook => {
webhook.edit({ webhook.edit({
@ -52,11 +53,6 @@ class fakebotCommand extends Command {
avatar: args.member.displayAvatarURL() avatar: args.member.displayAvatarURL()
}); });
webhook.edit({
name: args.member.username,
avatar: args.member.displayAvatarURL()
});
message.delete(); message.delete();
return webhook.send(args.message); return webhook.send(args.message);
}); });