mirror of
https://github.com/Hessenuk/DiscordTickets.git
synced 2025-01-10 18:06:27 +02:00
feat: transcript button in log channel
This commit is contained in:
parent
412c65c0ff
commit
2a96858782
22
src/buttons/transcript.js
Normal file
22
src/buttons/transcript.js
Normal file
@ -0,0 +1,22 @@
|
||||
const { Button } = require('@eartharoid/dbf');
|
||||
|
||||
module.exports = class ClaimButton extends Button {
|
||||
constructor(client, options) {
|
||||
super(client, {
|
||||
...options,
|
||||
id: 'transcript',
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {*} id
|
||||
* @param {import("discord.js").ChatInputCommandInteraction} interaction
|
||||
*/
|
||||
async run(id, interaction) {
|
||||
/** @type {import("client")} */
|
||||
const client = this.client;
|
||||
|
||||
const cmd = client.commands.commands.slash.get('transcript');
|
||||
return await cmd.run(interaction, id.ticket);
|
||||
}
|
||||
};
|
@ -129,12 +129,12 @@ module.exports = class TranscriptSlashCommand extends SlashCommand {
|
||||
/**
|
||||
* @param {import("discord.js").ChatInputCommandInteraction} interaction
|
||||
*/
|
||||
async run(interaction) {
|
||||
async run(interaction, ticketId) {
|
||||
/** @type {import("client")} */
|
||||
const client = this.client;
|
||||
|
||||
await interaction.deferReply({ ephemeral: true });
|
||||
const ticketId = interaction.options.getString('ticket', true);
|
||||
ticketId = ticketId || interaction.options.getString('ticket', true);
|
||||
const ticket = await client.prisma.ticket.findUnique({
|
||||
include: {
|
||||
archivedChannels: true,
|
||||
|
@ -26,6 +26,9 @@ buttons:
|
||||
unclaim:
|
||||
emoji: ♻️
|
||||
text: Release
|
||||
transcript:
|
||||
emoji: 📄
|
||||
text: Transcript
|
||||
commands:
|
||||
message:
|
||||
create:
|
||||
|
@ -1,4 +1,7 @@
|
||||
const {
|
||||
ActionRowBuilder,
|
||||
ButtonBuilder,
|
||||
ButtonStyle,
|
||||
cleanCodeBlockContent,
|
||||
EmbedBuilder,
|
||||
} = require('discord.js');
|
||||
@ -182,7 +185,24 @@ async function logTicketEvent(client, {
|
||||
);
|
||||
}
|
||||
|
||||
return await channel.send({ embeds });
|
||||
return await channel.send({
|
||||
components:
|
||||
action === 'close' ? [
|
||||
new ActionRowBuilder()
|
||||
.addComponents(
|
||||
new ButtonBuilder()
|
||||
.setCustomId(JSON.stringify({
|
||||
action: 'transcript',
|
||||
ticket: target.id,
|
||||
}))
|
||||
.setStyle(ButtonStyle.Primary)
|
||||
.setEmoji(getMessage('buttons.transcript.emoji'))
|
||||
.setLabel(getMessage('buttons.transcript.text')),
|
||||
|
||||
),
|
||||
] : [],
|
||||
embeds,
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user