From 956648c265f991ba572f8c8d5068a98cc9dbf28d Mon Sep 17 00:00:00 2001 From: Isaac Date: Sun, 4 Sep 2022 21:00:18 +0100 Subject: [PATCH] Update `ticket` autocompleter --- src/autocomplete/ticket.js | 6 +++--- src/commands/slash/add.js | 3 ++- src/commands/slash/close.js | 2 +- src/commands/slash/remove.js | 3 ++- 4 files changed, 8 insertions(+), 6 deletions(-) diff --git a/src/autocomplete/ticket.js b/src/autocomplete/ticket.js index ea4473b..7f86dbe 100644 --- a/src/autocomplete/ticket.js +++ b/src/autocomplete/ticket.js @@ -11,10 +11,10 @@ module.exports = class TicketCompleter extends Autocompleter { /** * @param {string} value - * @param {*} comamnd + * @param {*} command * @param {import("discord.js").AutocompleteInteraction} interaction */ - async run(value, comamnd, interaction) { + async run(value, command, interaction) { /** @type {import("client")} */ const client = this.client; const settings = await client.prisma.guild.findUnique({ where: { id: interaction.guild.id } }); @@ -30,7 +30,7 @@ module.exports = class TicketCompleter extends Autocompleter { where: { createdById: interaction.user.id, guildId: interaction.guild.id, - open: false, + open: ['add', 'close', 'force-close', 'remove'].includes(command.name), // false for `new`, `transcript` etc }, }); const options = value ? tickets.filter(t => diff --git a/src/commands/slash/add.js b/src/commands/slash/add.js index c126a41..6768441 100644 --- a/src/commands/slash/add.js +++ b/src/commands/slash/add.js @@ -16,9 +16,10 @@ module.exports = class AddSlashCommand extends SlashCommand { type: ApplicationCommandOptionType.User, }, { + autocomplete: true, name: 'ticket', required: false, - type: ApplicationCommandOptionType.Channel, + type: ApplicationCommandOptionType.Integer, }, ]; opts = opts.map(o => { diff --git a/src/commands/slash/close.js b/src/commands/slash/close.js index 3705e54..4e55840 100644 --- a/src/commands/slash/close.js +++ b/src/commands/slash/close.js @@ -19,7 +19,7 @@ module.exports = class CloseSlashCommand extends SlashCommand { autocomplete: true, name: 'ticket', required: false, - type: ApplicationCommandOptionType.String, + type: ApplicationCommandOptionType.Integer, }, { name: 'time', diff --git a/src/commands/slash/remove.js b/src/commands/slash/remove.js index aded8e2..6923bd4 100644 --- a/src/commands/slash/remove.js +++ b/src/commands/slash/remove.js @@ -16,9 +16,10 @@ module.exports = class RemoveSlashCommand extends SlashCommand { type: ApplicationCommandOptionType.User, }, { + autocomplete: true, name: 'ticket', required: false, - type: ApplicationCommandOptionType.Channel, + type: ApplicationCommandOptionType.Integer, }, ]; opts = opts.map(o => {