mirror of
https://github.com/nx-bat/discordbot-ng.git
synced 2026-11-11 07:13:37 -05:00
Compare commits
13
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
eb1b94c235 | ||
|
|
9755666040 | ||
|
|
e5910899ca | ||
|
|
f17a3b5521 | ||
|
|
63152ffaf5 | ||
|
|
99fd6403a2 | ||
|
|
c2c6d5f9f0 | ||
|
|
a996947157 | ||
|
|
741b56a3dd | ||
|
|
96c783fb96 | ||
|
|
0fbb8918dc | ||
|
|
920fc347fb | ||
|
|
9d31d5a3e0 |
@@ -1,5 +1,4 @@
|
|||||||
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',
|
||||||
@@ -20,9 +19,13 @@ export default {
|
|||||||
components: []
|
components: []
|
||||||
});
|
});
|
||||||
|
|
||||||
if (!await closeTicket(client, channel, 'This ticket has been closed by staff.'))
|
await channel.send('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
|
||||||
|
});
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
+12
-10
@@ -1,26 +1,28 @@
|
|||||||
import { ButtonInteraction, Client, MessageFlags, ChannelType } from 'discord.js';
|
import { ButtonInteraction, Client, MessageFlags, ChannelType } from 'discord.js';
|
||||||
import { closeTicket } from '../utils';
|
import { Database } from '../shared/Database';
|
||||||
|
|
||||||
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)
|
|
||||||
return await interaction.reply({ flags: [MessageFlags.Ephemeral], content: 'Oops. Something went wrong. Please report this to a staff member.' });
|
|
||||||
|
|
||||||
await interaction.reply({
|
if (!channel || !channel.isThread() || !channel.isSendable() || channel.type != ChannelType.PrivateThread)
|
||||||
content: 'Closing, please wait...',
|
return interaction.reply({ flags: [MessageFlags.Ephemeral], content: 'Oops. Something went wrong. Please report this to a staff member.' });
|
||||||
flags: MessageFlags.Ephemeral
|
|
||||||
});
|
|
||||||
|
|
||||||
await interaction.message.edit({
|
await interaction.message.edit({
|
||||||
content: interaction.message.content,
|
content: interaction.message.content,
|
||||||
components: []
|
components: []
|
||||||
});
|
});
|
||||||
|
|
||||||
if (!await closeTicket(client, channel, `This ticket has been closed by ${interaction.user}`))
|
await Database.closePrivateHelpTicket(channel.id);
|
||||||
return await interaction.editReply({ content: 'An error occurred while trying to close this ticket.' });
|
|
||||||
|
|
||||||
await interaction.editReply({ content: 'Ticket closed.' });
|
await channel.send(`This ticket has been closed by ${interaction.user}`);
|
||||||
|
|
||||||
|
await interaction.reply({ flags: [MessageFlags.Ephemeral], content: 'Ticket closed.' });
|
||||||
|
|
||||||
|
channel.edit({
|
||||||
|
archived: true,
|
||||||
|
locked: true
|
||||||
|
});
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@@ -121,8 +121,9 @@ 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 automatically add you to the thread.', true);
|
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);
|
||||||
|
|
||||||
modal.addLabelComponents(titleLabel, initialMessageLabel, autoJoinLabel);
|
modal.addLabelComponents(titleLabel, initialMessageLabel, autoJoinLabel);
|
||||||
|
|
||||||
interaction.showModal(modal);
|
interaction.showModal(modal);
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user