From dfb3f1ca023c863d631afb531f31dfca45d28f03 Mon Sep 17 00:00:00 2001 From: Isaac Date: Tue, 23 Mar 2021 23:50:00 +0000 Subject: [PATCH] settings command stuff --- src/commands/_settings.js | 17 +++++++++-------- src/locales/en-GB.json | 5 ++++- 2 files changed, 13 insertions(+), 9 deletions(-) diff --git a/src/commands/_settings.js b/src/commands/_settings.js index 3d99e56..b537f6e 100644 --- a/src/commands/_settings.js +++ b/src/commands/_settings.js @@ -68,13 +68,13 @@ module.exports = class SettingsCommand extends Command { ); } else { // create a new category - let created = await guild.channels.create(c.name, { + let cat_channel = await guild.channels.create(c.name, { type: 'category', reason: `Tickets category created by ${member.user.tag}`, permissionOverwrites: permissions }); await this.client.db.models.Category.create({ - id: created.id, + id: cat_channel.id, name: c.name, guild: guild.id, roles: c.roles @@ -82,7 +82,7 @@ module.exports = class SettingsCommand extends Command { } } - channel.send(`\`\`\`json\n${JSON.stringify(data, null, 2)}\n\`\`\``); + channel.send(i18n('commands.settings.response.updated')); } else { // upload settings as json to be modified let data = { @@ -100,20 +100,21 @@ module.exports = class SettingsCommand extends Command { } }); - for (let c of categories) { - data.categories.push({ + data.categories = categories.map(c =>{ + return { id: c.id, name: c.name, roles: c.roles - }); - } + }; + }); + console.log(data) let attachment = new MessageAttachment( Buffer.from(JSON.stringify(data, null, 2)), `Settings for ${guild.name}.json` ); - channel.send(i18n('commands.settings.response'), { + channel.send({ files: [attachment] }); } diff --git a/src/locales/en-GB.json b/src/locales/en-GB.json index bcd389c..3641d24 100644 --- a/src/locales/en-GB.json +++ b/src/locales/en-GB.json @@ -20,7 +20,10 @@ }, "settings": { "name": "settings", - "description": "Configure Discord Tickets" + "description": "Configure Discord Tickets", + "response": { + "updated": "✅ Settings have been updated." + } } }, "must_be_slash": "❌ This command must be invoked by a slash command interaction (`/%s`).",