mirror of
https://github.com/ARK-Unity/ark-unity.git
synced 2024-07-06 20:50:11 +02:00
Compare commits
2 Commits
0c2770dbdf
...
8fd1891b20
Author | SHA1 | Date | |
---|---|---|---|
8fd1891b20 | |||
5f8fe7bef1 |
|
@ -133,6 +133,7 @@ export const SUPPORT_TICKETS_CATEGORIES: SupportTicketsCategories = new Map([
|
|||
{
|
||||
title: "Server/Cluster Promotion",
|
||||
description: "Want to promote your server/cluster?",
|
||||
shouldInheritCategoryPermissions: false,
|
||||
id: SUPPORT_TICKETS_PROMOTION_ID,
|
||||
emoji: "🌐",
|
||||
textInputs: [
|
||||
|
|
|
@ -20,6 +20,7 @@ export const SUPPORT_TICKETS_SELECT_MENU_ID = "support-tickets-select-menu-id"
|
|||
export interface SupportTicketCategory {
|
||||
title: string
|
||||
description: string
|
||||
shouldInheritCategoryPermissions?: boolean
|
||||
id: string
|
||||
emoji: string
|
||||
textInputs: TextInputBuilder[]
|
||||
|
|
|
@ -1,15 +1,16 @@
|
|||
import type { OverwriteResolvable } from "discord.js"
|
||||
import {
|
||||
GuildMember,
|
||||
Guild,
|
||||
ChannelType,
|
||||
userMention,
|
||||
EmbedBuilder,
|
||||
channelMention,
|
||||
codeBlock,
|
||||
ActionRowBuilder,
|
||||
ButtonBuilder,
|
||||
ButtonStyle,
|
||||
CategoryChannel,
|
||||
ChannelType,
|
||||
EmbedBuilder,
|
||||
Guild,
|
||||
GuildMember,
|
||||
channelMention,
|
||||
codeBlock,
|
||||
userMention,
|
||||
} from "discord.js"
|
||||
|
||||
import type { HandleInteractionCreateSupportTickets } from "#src/support-tickets/configuration.js"
|
||||
|
@ -66,17 +67,30 @@ export const handleSupportTicketsModalSubmit: HandleInteractionCreateSupportTick
|
|||
return false
|
||||
}
|
||||
|
||||
const { shouldInheritCategoryPermissions = true, textInputs } = category
|
||||
|
||||
const permissionOverwrites: OverwriteResolvable[] = [
|
||||
{
|
||||
allow: ["ViewChannel", "SendMessages"],
|
||||
id: interaction.member.user.id,
|
||||
},
|
||||
]
|
||||
if (shouldInheritCategoryPermissions) {
|
||||
permissionOverwrites.push(
|
||||
...channelCategory.permissionOverwrites.valueOf().toJSON(),
|
||||
)
|
||||
} else {
|
||||
permissionOverwrites.push({
|
||||
deny: ["ViewChannel", "SendMessages"],
|
||||
id: interaction.guild.roles.everyone.id,
|
||||
})
|
||||
}
|
||||
|
||||
const channel = await interaction.guild.channels.create({
|
||||
name: channelName,
|
||||
type: ChannelType.GuildText,
|
||||
parent: DISCORD_SUPPORT_TICKETS_OPEN_CATEGORY_ID,
|
||||
permissionOverwrites: [
|
||||
{
|
||||
allow: ["ViewChannel", "SendMessages"],
|
||||
id: interaction.member.user.id,
|
||||
},
|
||||
...channelCategory.permissionOverwrites.valueOf().toJSON(),
|
||||
],
|
||||
permissionOverwrites,
|
||||
})
|
||||
await channel.send({
|
||||
content: userMention(interaction.member.id),
|
||||
|
@ -92,7 +106,7 @@ To close this ticket react with the button below.
|
|||
.setImage(supportTicketsImageURL)
|
||||
.setColor([56, 142, 60]),
|
||||
new EmbedBuilder().setDescription(
|
||||
category.textInputs
|
||||
textInputs
|
||||
.map((textInput, index) => {
|
||||
const label = textInput.data.label ?? `Field ${index}`
|
||||
const value = interaction.fields.getTextInputValue(
|
||||
|
|
Loading…
Reference in New Issue
Block a user