mirror of
https://github.com/nx-bat/discordbot-ng.git
synced 2026-11-11 07:13:37 -05:00
Compare commits
2
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
62001bcbbf | ||
|
|
567916dafb |
@@ -1,4 +1,5 @@
|
|||||||
import { ButtonInteraction, Client, MessageFlags, ChannelType, PermissionFlagsBits } from 'discord.js';
|
import { ButtonInteraction, Client, MessageFlags, ChannelType, PermissionFlagsBits } from 'discord.js';
|
||||||
|
import { closeTicket } from '../utils';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'close-mod-ticket',
|
name: 'close-mod-ticket',
|
||||||
@@ -19,13 +20,9 @@ export default {
|
|||||||
components: []
|
components: []
|
||||||
});
|
});
|
||||||
|
|
||||||
await channel.send('This ticket has been closed by staff.');
|
if (!await closeTicket(client, channel, 'This ticket has been closed by staff.'))
|
||||||
|
return await interaction.editReply({ content: 'An error occurred while trying to close this ticket.' });
|
||||||
|
|
||||||
await interaction.editReply({ content: 'Ticket closed.' });
|
await interaction.editReply({ content: 'Ticket closed.' });
|
||||||
|
|
||||||
channel.edit({
|
|
||||||
archived: true,
|
|
||||||
locked: true
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
+10
-12
@@ -1,28 +1,26 @@
|
|||||||
import { ButtonInteraction, Client, MessageFlags, ChannelType } from 'discord.js';
|
import { ButtonInteraction, Client, MessageFlags, ChannelType } from 'discord.js';
|
||||||
import { Database } from '../shared/Database';
|
import { closeTicket } from '../utils';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'close-ticket',
|
name: 'close-ticket',
|
||||||
handler: async function (client: Client, interaction: ButtonInteraction) {
|
handler: async function (client: Client, interaction: ButtonInteraction) {
|
||||||
const channel = await interaction.channel?.fetch();
|
const channel = await interaction.channel?.fetch();
|
||||||
|
|
||||||
if (!channel || !channel.isThread() || !channel.isSendable() || channel.type != ChannelType.PrivateThread)
|
if (!channel || !channel.isThread() || !channel.isSendable() || channel.type != ChannelType.PrivateThread)
|
||||||
return interaction.reply({ flags: [MessageFlags.Ephemeral], content: 'Oops. Something went wrong. Please report this to a staff member.' });
|
return await interaction.reply({ flags: [MessageFlags.Ephemeral], content: 'Oops. Something went wrong. Please report this to a staff member.' });
|
||||||
|
|
||||||
|
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(client, channel, `This ticket has been closed by ${interaction.user}`))
|
||||||
|
return await interaction.editReply({ content: 'An error occurred while trying to close this ticket.' });
|
||||||
|
|
||||||
await channel.send(`This ticket has been closed by ${interaction.user}`);
|
await interaction.editReply({ content: 'Ticket closed.' });
|
||||||
|
|
||||||
await interaction.reply({ flags: [MessageFlags.Ephemeral], content: 'Ticket closed.' });
|
|
||||||
|
|
||||||
channel.edit({
|
|
||||||
archived: true,
|
|
||||||
locked: true
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@@ -121,9 +121,8 @@ export async function openModTicketModal(interaction: UserContextMenuCommandInte
|
|||||||
|
|
||||||
const titleLabel = createTextInput('title', 'Title', `The name of the thread. Defaults to "Mod Ticket For ${member.displayName}" if left empty`, false, TextInputStyle.Short, 100, null);
|
const titleLabel = createTextInput('title', 'Title', `The name of the thread. Defaults to "Mod Ticket For ${member.displayName}" if left empty`, false, TextInputStyle.Short, 100, null);
|
||||||
const initialMessageLabel = createTextInput('initial-message', 'Inital Message', 'The inital message sent in the thread', false, TextInputStyle.Paragraph, 1800, null);
|
const initialMessageLabel = createTextInput('initial-message', 'Inital Message', 'The inital message sent in the thread', false, TextInputStyle.Paragraph, 1800, null);
|
||||||
const autoJoinLabel = createCheckbox('auto-join-thread', 'Auto Join Thread', 'Whether or not to join you to the thread. Selecting no will not notify you of messages sent!', true);
|
const autoJoinLabel = createCheckbox('auto-join-thread', 'Auto Join Thread', 'Whether or not to automatically add you to the thread.', true);
|
||||||
|
|
||||||
modal.addLabelComponents(titleLabel, initialMessageLabel, autoJoinLabel);
|
modal.addLabelComponents(titleLabel, initialMessageLabel, autoJoinLabel);
|
||||||
|
|
||||||
interaction.showModal(modal);
|
interaction.showModal(modal);
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user