diff --git a/src/commands/message/create.js b/src/commands/message/create.js index 51dc5cf42..2d83afe8a 100644 --- a/src/commands/message/create.js +++ b/src/commands/message/create.js @@ -18,6 +18,6 @@ module.exports = class CreateMessageCommand extends MessageCommand { * @param {import("discord.js").MessageContextMenuCommandInteraction} interaction */ async run(interaction) { - await useGuild(this.client, interaction, { referencesMessage: interaction.targetMessage.channelId + '/' + interaction.targetId }); + await useGuild(this.client, interaction, { referencesMessageId: interaction.targetId }); } -}; \ No newline at end of file +}; diff --git a/src/lib/tickets/manager.js b/src/lib/tickets/manager.js index 7e70ab6b6..67873f521 100644 --- a/src/lib/tickets/manager.js +++ b/src/lib/tickets/manager.js @@ -155,7 +155,7 @@ module.exports = class TicketManager { * @param {string?} [data.topic] */ async create({ - categoryId, interaction, topic, referencesMessage, referencesTicketId, + categoryId, interaction, topic, referencesMessageId, referencesTicketId, }) { categoryId = Number(categoryId); const category = await this.getCategory(categoryId); @@ -276,7 +276,7 @@ module.exports = class TicketManager { .setCustomId(JSON.stringify({ action: 'questions', categoryId, - referencesMessage, + referencesMessageId, referencesTicketId, })) .setTitle(category.name) @@ -324,7 +324,7 @@ module.exports = class TicketManager { .setCustomId(JSON.stringify({ action: 'topic', categoryId, - referencesMessage, + referencesMessageId, referencesTicketId, })) .setTitle(category.name) @@ -346,7 +346,7 @@ module.exports = class TicketManager { await this.postQuestions({ categoryId, interaction, - referencesMessage, + referencesMessageId, referencesTicketId, topic, }); @@ -360,7 +360,7 @@ module.exports = class TicketManager { * @param {string?} [data.topic] */ async postQuestions({ - action, categoryId, interaction, topic, referencesMessage, referencesTicketId, + action, categoryId, interaction, topic, referencesMessageId, referencesTicketId, }) { const [, category] = await Promise.all([ interaction.deferReply({ ephemeral: true }), @@ -540,14 +540,13 @@ module.exports = class TicketManager { /** @type {import("discord.js").Message|undefined} */ let message; - if (referencesMessage) { - referencesMessage = referencesMessage.split('/'); + if (referencesMessageId) { /** @type {import("discord.js").Message} */ - message = await (await this.client.channels.fetch(referencesMessage[0]))?.messages.fetch(referencesMessage[1]); + message = await interaction.channel.messages.fetch(referencesMessageId); if (message) { // not worth the effort of making system messages work atm if (message.system) { - referencesMessage = null; + referencesMessageId = null; message = null; } else { if (!message.member) { diff --git a/src/lib/tickets/utils.js b/src/lib/tickets/utils.js index 21a74e8b2..ab388d7dc 100644 --- a/src/lib/tickets/utils.js +++ b/src/lib/tickets/utils.js @@ -12,7 +12,7 @@ module.exports = { * @param {import("discord.js").ButtonInteraction|import("discord.js").SelectMenuInteraction} interaction */ async useGuild(client, interaction, { - referencesMessage, + referencesMessageId, referencesTicketId, topic, }) { @@ -41,7 +41,7 @@ module.exports = { await client.tickets.create({ categoryId: settings.categories[0].id, interaction, - referencesMessage, + referencesMessageId, referencesTicketId, topic, }); @@ -53,7 +53,7 @@ module.exports = { new StringSelectMenuBuilder() .setCustomId(JSON.stringify({ action: 'create', - referencesMessage, + referencesMessageId, referencesTicketId, topic, }))