diff --git a/commands/admin/untag.js b/commands/admin/untag.js new file mode 100644 index 00000000..dfcf9fad --- /dev/null +++ b/commands/admin/untag.js @@ -0,0 +1,52 @@ +const { Command } = require('discord-akairo'); +const fs = require('fs'); + +class UnTagCommand extends Command { + constructor() { + super('untag', { + aliases: ['untag'], + category: 'admin', + split: 'none', + args: [ + { + id: "trigger", + type: "string" + } + ], + channelRestriction: 'guild', + description: { + content: 'Remove created custom autoresponse', + usage: '[trigger]', + examples: ['"do you know da wea"'] + } + }); + } + + async exec(message, args) { + let trigger = args.trigger; + + trigger = trigger.toLowerCase(); + + let customresponse = {} + let json = JSON.stringify(customresponse) + + + fs.readFile(`./tag/${message.guild.id}.json`, 'utf8', function readFileCallback(err, data){ + if (err){ + console.log(err); + } else { + customresponse = JSON.parse(data); //now it an object + delete customresponse[trigger] + json = JSON.stringify(customresponse); //convert it back to json + fs.writeFile(`./tag/${message.guild.id}.json`, json, 'utf8', function(err) { + if(err) { + return console.log(err); + } + })}}); + + return message.say(`The following autoresponse have been deleted: ${trigger}`); + + } +} + +module.exports = UnTagCommand; \ No newline at end of file diff --git a/commands/images/fetish.js b/commands/images/fetish.js index 463fea41..4fe5ef8e 100644 --- a/commands/images/fetish.js +++ b/commands/images/fetish.js @@ -17,7 +17,7 @@ class FetishCommand extends Command { }); } - async exec(message,args) { + async exec(message, args) { let Attachment = (message.attachments).array(); let image = args.image; if (!Attachment[0] && !image) diff --git a/commands/images/god.js b/commands/images/god.js index 6bbb8cc7..e645b768 100644 --- a/commands/images/god.js +++ b/commands/images/god.js @@ -12,7 +12,7 @@ class GodCommand extends Command { }); } - async exec(message) { + async exec(message, args) { let Attachment = (message.attachments).array(); let image = args.image; if (!Attachment[0] && !image) diff --git a/commands/images/idubbbz.js b/commands/images/idubbbz.js index 8e1176cc..8776510a 100644 --- a/commands/images/idubbbz.js +++ b/commands/images/idubbbz.js @@ -11,7 +11,7 @@ class IdubbbzCommand extends Command { }); } - async exec(message) { + async exec(message, args) { let Attachment = (message.attachments).array(); let image = args.image; if (!Attachment[0] && !image) diff --git a/commands/images/idubbbzpaint.js b/commands/images/idubbbzpaint.js index 38cf860b..1906ec6e 100644 --- a/commands/images/idubbbzpaint.js +++ b/commands/images/idubbbzpaint.js @@ -11,7 +11,7 @@ class IdubbbzPaintCommand extends Command { }); } - async exec(message) { + async exec(message, args) { let Attachment = (message.attachments).array(); let image = args.image; if (!Attachment[0] && !image) diff --git a/commands/images/like.js b/commands/images/like.js index 117ae0a7..064bb6b3 100644 --- a/commands/images/like.js +++ b/commands/images/like.js @@ -17,7 +17,7 @@ class LikeCommand extends Command { }); } - async exec(message,args) { + async exec(message, args) { let Attachment = (message.attachments).array(); let image = args.image; if (!Attachment[0] && !image) diff --git a/commands/images/ugly.js b/commands/images/ugly.js index e40070de..8292a447 100644 --- a/commands/images/ugly.js +++ b/commands/images/ugly.js @@ -18,7 +18,7 @@ class UglyCommand extends Command { }); } - async exec(message,args) { + async exec(message, args) { let Attachment = (message.attachments).array(); let image = args.image; if (!Attachment[0] && !image)