Add message and ticket referencing, fixes

This commit is contained in:
Isaac
2022-08-13 23:01:44 +01:00
parent f6666b103e
commit c64b18a397
10 changed files with 262 additions and 38 deletions

View File

@@ -1,4 +1,5 @@
const { MessageCommand } = require('@eartharoid/dbf');
const { useGuild } = require('../../lib/tickets/utils');
module.exports = class CreateMessageCommand extends MessageCommand {
constructor(client, options) {
@@ -13,7 +14,11 @@ module.exports = class CreateMessageCommand extends MessageCommand {
});
}
/**
* @param {import("discord.js").MessageContextMenuCommandInteraction} interaction
*/
async run(interaction) {
// TODO: archive message
await useGuild(this.client, interaction, { referencesMessage: interaction.targetMessage.channelId + '/' + interaction.targetId });
}
};

View File

@@ -1,5 +1,6 @@
const { SlashCommand } = require('@eartharoid/dbf');
const { ApplicationCommandOptionType } = require('discord.js');
const { useGuild } = require('../../lib/tickets/utils');
module.exports = class NewSlashCommand extends SlashCommand {
constructor(client, options) {
@@ -14,7 +15,7 @@ module.exports = class NewSlashCommand extends SlashCommand {
autocomplete: true,
name: 'references',
required: false,
type: ApplicationCommandOptionType.Integer,
type: ApplicationCommandOptionType.String,
},
];
opts = opts.map(o => {
@@ -43,5 +44,12 @@ module.exports = class NewSlashCommand extends SlashCommand {
});
}
async run(interaction) { }
/**
*
* @param {import("discord.js").ChatInputCommandInteraction} interaction
*/
async run(interaction) {
await useGuild(this.client, interaction, { referencesTicketId: interaction.options.getString('references', false) });
}
};