mirror of
https://github.com/nx-bat/discordbot-ng.git
synced 2026-11-11 07:13:37 -05:00
Fix additional conflicts manually.
This commit is contained in:
@@ -1,5 +1,6 @@
|
|||||||
import { ButtonInteraction, Client, MessageFlags, ChannelType } from 'discord.js';
|
import { ButtonInteraction, Client, MessageFlags, ChannelType } from 'discord.js';
|
||||||
import { Button } from '../types';
|
import { Button } from '../types';
|
||||||
|
import { closeTicket } from '../utils';
|
||||||
|
|
||||||
class CloseModTicketButton implements Button<Client> {
|
class CloseModTicketButton implements Button<Client> {
|
||||||
id = 'close-mod-ticket';
|
id = 'close-mod-ticket';
|
||||||
@@ -22,14 +23,12 @@ class CloseModTicketButton implements Button<Client> {
|
|||||||
components: []
|
components: []
|
||||||
});
|
});
|
||||||
|
|
||||||
await channel.send('This ticket has been closed by staff.');
|
if (!await closeTicket(context, channel, 'This ticket has been closed by staff.')) {
|
||||||
|
await interaction.editReply({ content: 'An error occurred while trying to close this ticket.' });
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
await interaction.editReply({ content: 'Ticket closed.' });
|
await interaction.editReply({ content: 'Ticket closed.' });
|
||||||
|
|
||||||
await channel.edit({
|
|
||||||
archived: true,
|
|
||||||
locked: true
|
|
||||||
});
|
|
||||||
} catch (error: Error | any) {
|
} catch (error: Error | any) {
|
||||||
await interaction.editReply({ content: error.message }).catch(() => {});
|
await interaction.editReply({ content: error.message }).catch(() => {});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import { ButtonInteraction, Client, MessageFlags, ChannelType } from 'discord.js';
|
import { ButtonInteraction, Client, MessageFlags, ChannelType } from 'discord.js';
|
||||||
import { Database } from '../shared/Database';
|
|
||||||
import { Button } from '../types';
|
import { Button } from '../types';
|
||||||
|
import { closeTicket } from '../utils';
|
||||||
|
|
||||||
class CloseTicketButton implements Button<Client> {
|
class CloseTicketButton implements Button<Client> {
|
||||||
id = 'close-ticket';
|
id = 'close-ticket';
|
||||||
@@ -16,21 +16,22 @@ class CloseTicketButton implements Button<Client> {
|
|||||||
if (!channel.isThread() || channel.type != ChannelType.PrivateThread) throw new Error('This interaction was not run in a ticket thread.');
|
if (!channel.isThread() || channel.type != ChannelType.PrivateThread) throw new Error('This interaction was not run in a ticket thread.');
|
||||||
if (!channel.isSendable()) throw new Error("I don't have permission to send messages in this channel.");
|
if (!channel.isSendable()) throw new Error("I don't have permission to send messages in this channel.");
|
||||||
|
|
||||||
|
await interaction.reply({
|
||||||
|
content: 'Closing, please wait...',
|
||||||
|
flags: MessageFlags.Ephemeral
|
||||||
|
});
|
||||||
|
|
||||||
await interaction.message.edit({
|
await interaction.message.edit({
|
||||||
content: interaction.message.content,
|
content: interaction.message.content,
|
||||||
components: []
|
components: []
|
||||||
});
|
});
|
||||||
|
|
||||||
await Database.closePrivateHelpTicket(channel.id);
|
if (!await closeTicket(context, channel, `This ticket has been closed by ${interaction.user}`)) {
|
||||||
|
await interaction.editReply({ content: 'An error occurred while trying to close this ticket.' });
|
||||||
await channel.send(`This ticket has been closed by ${interaction.user}`);
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
await interaction.editReply({ content: 'Ticket closed.' });
|
await interaction.editReply({ content: 'Ticket closed.' });
|
||||||
|
|
||||||
await channel.edit({
|
|
||||||
archived: true,
|
|
||||||
locked: true
|
|
||||||
});
|
|
||||||
} catch (error: Error | any) {
|
} catch (error: Error | any) {
|
||||||
await interaction.editReply({ content: error.message }).catch(() => {});
|
await interaction.editReply({ content: error.message }).catch(() => {});
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user