settings command stuff

This commit is contained in:
Isaac 2021-03-23 23:50:00 +00:00
parent ffc415354a
commit dfb3f1ca02
2 changed files with 13 additions and 9 deletions

View File

@ -68,13 +68,13 @@ module.exports = class SettingsCommand extends Command {
); );
} else { } else {
// create a new category // create a new category
let created = await guild.channels.create(c.name, { let cat_channel = await guild.channels.create(c.name, {
type: 'category', type: 'category',
reason: `Tickets category created by ${member.user.tag}`, reason: `Tickets category created by ${member.user.tag}`,
permissionOverwrites: permissions permissionOverwrites: permissions
}); });
await this.client.db.models.Category.create({ await this.client.db.models.Category.create({
id: created.id, id: cat_channel.id,
name: c.name, name: c.name,
guild: guild.id, guild: guild.id,
roles: c.roles 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 { } else {
// upload settings as json to be modified // upload settings as json to be modified
let data = { let data = {
@ -100,20 +100,21 @@ module.exports = class SettingsCommand extends Command {
} }
}); });
for (let c of categories) { data.categories = categories.map(c =>{
data.categories.push({ return {
id: c.id, id: c.id,
name: c.name, name: c.name,
roles: c.roles roles: c.roles
}); };
} });
console.log(data)
let attachment = new MessageAttachment( let attachment = new MessageAttachment(
Buffer.from(JSON.stringify(data, null, 2)), Buffer.from(JSON.stringify(data, null, 2)),
`Settings for ${guild.name}.json` `Settings for ${guild.name}.json`
); );
channel.send(i18n('commands.settings.response'), { channel.send({
files: [attachment] files: [attachment]
}); });
} }

View File

@ -20,7 +20,10 @@
}, },
"settings": { "settings": {
"name": "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`).", "must_be_slash": "❌ This command must be invoked by a slash command interaction (`/%s`).",