Fixed welcome
diff --git a/src/commands/settings/tickets.ts b/src/commands/settings/tickets.ts
index f199ac3..44f974e 100644
--- a/src/commands/settings/tickets.ts
+++ b/src/commands/settings/tickets.ts
@@ -192,6 +192,11 @@
.setEmoji(getEmojiByName("TICKETS.OTHER", "id"))
.setStyle("SECONDARY")
.setCustomId("manageTypes"),
+ new MessageButton()
+ .setLabel("Add create ticket button")
+ .setEmoji(getEmojiByName("TICKETS.SUGGESTION", "id"))
+ .setStyle("PRIMARY")
+ .setCustomId("send"),
])]
});
let i;
@@ -217,6 +222,122 @@
await client.database.guilds.write(interaction.guild.id, null, ["tickets.supportRole"])
data.supportRole = undefined;
} else lastClicked = "sup";
+ } else if (i.component.customId === "send") {
+ const ticketMessages = [
+ {label: "Create ticket", description: "Click the button below to create a ticket"},
+ {label: "Issues, questions or feedback?", description: "Click below to open a ticket and get help from our staff team"},
+ {label: "Contact Us", description: "Click the button below to speak to us privately"},
+ ]
+ while (true) {
+ let enabled = data.enabled && data.category !== null;
+ await interaction.editReply({embeds: [new EmojiEmbed()
+ .setTitle("Ticket Button")
+ .setDescription("Select a message template to send in this channel")
+ .setFooter({text: enabled ? "" : "Tickets are not set up correctly so the button may not work for users. Check the main menu to find which options must be set."})
+ .setStatus(enabled ? "Success" : "Warning")
+ .setEmoji("GUILD.ROLES.CREATE")
+ ], components: [
+ new MessageActionRow().addComponents([
+ new MessageSelectMenu().setOptions(ticketMessages.map((t: {label: string, description: string, value?: string}, index) => {
+ t.value = index.toString(); return t as {value: string, label: string, description: string}
+ })).setCustomId("template").setMaxValues(1).setMinValues(1).setPlaceholder("Select a message template"),
+ ]),
+ new MessageActionRow().addComponents([
+ new MessageButton()
+ .setCustomId("back")
+ .setLabel("Back")
+ .setEmoji(getEmojiByName("CONTROL.LEFT", "id"))
+ .setStyle("DANGER"),
+ new MessageButton()
+ .setCustomId("blank")
+ .setLabel("Empty")
+ .setStyle("SECONDARY"),
+ new MessageButton()
+ .setCustomId("custom")
+ .setLabel("Custom")
+ .setEmoji(getEmojiByName("TICKETS.OTHER", "id"))
+ .setStyle("PRIMARY")
+ ])
+ ]});
+ let i;
+ try {
+ i = await m.awaitMessageComponent({time: 300000});
+ } catch(e) { break }
+ if (i.component.customId === "template") {
+ i.deferUpdate()
+ await interaction.channel.send({embeds: [new EmojiEmbed()
+ .setTitle(ticketMessages[parseInt(i.values[0])].label)
+ .setDescription(ticketMessages[parseInt(i.values[0])].description)
+ .setStatus("Success")
+ .setEmoji("GUILD.TICKET.OPEN")
+ ], components: [new MessageActionRow().addComponents([new MessageButton()
+ .setLabel("Create Ticket")
+ .setEmoji(getEmojiByName("CONTROL.TICK", "id"))
+ .setStyle("SUCCESS")
+ .setCustomId("createticket")
+ ])]});
+ break
+ } else if (i.component.customId === "blank") {
+ i.deferUpdate()
+ await interaction.channel.send({components: [new MessageActionRow().addComponents([new MessageButton()
+ .setLabel("Create Ticket")
+ .setEmoji(getEmojiByName("TICKETS.SUGGESTION", "id"))
+ .setStyle("SUCCESS")
+ .setCustomId("createticket")
+ ])]});
+ break
+ } else if (i.component.customId === "custom") {
+ await i.showModal(new Discord.Modal().setCustomId("modal").setTitle(`Enter embed details`).addComponents(
+ new MessageActionRow<TextInputComponent>().addComponents(new TextInputComponent()
+ .setCustomId("title")
+ .setLabel("Title")
+ .setMaxLength(256)
+ .setRequired(true)
+ .setStyle("SHORT")
+ ),
+ new MessageActionRow<TextInputComponent>().addComponents(new TextInputComponent()
+ .setCustomId("description")
+ .setLabel("Description")
+ .setMaxLength(4000)
+ .setRequired(true)
+ .setStyle("PARAGRAPH")
+ )
+ ))
+ await interaction.editReply({
+ embeds: [new EmojiEmbed()
+ .setTitle("Ticket Button")
+ .setDescription("Modal opened. If you can't see it, click back and try again.")
+ .setStatus("Success")
+ .setEmoji("GUILD.TICKET.OPEN")
+ ], components: [new MessageActionRow().addComponents([new MessageButton()
+ .setLabel("Back")
+ .setEmoji(getEmojiByName("CONTROL.LEFT", "id"))
+ .setStyle("PRIMARY")
+ .setCustomId("back")
+ ])]
+ });
+ let out;
+ try {
+ out = await modalInteractionCollector(m, (m) => m.channel.id === interaction.channel.id, (m) => m.customId === "modify")
+ } catch (e) { break }
+ if (out.fields) {
+ let title = out.fields.getTextInputValue("title");
+ let description = out.fields.getTextInputValue("description");
+ await interaction.channel.send({embeds: [new EmojiEmbed()
+ .setTitle(title)
+ .setDescription(description)
+ .setStatus("Success")
+ .setEmoji("GUILD.TICKET.OPEN")
+ ], components: [new MessageActionRow().addComponents([new MessageButton()
+ .setLabel("Create Ticket")
+ .setEmoji(getEmojiByName("TICKETS.SUGGESTION", "id"))
+ .setStyle("SUCCESS")
+ .setCustomId("createticket")
+ ])]});
+ break
+ } else { continue }
+ }
+ }
} else if (i.component.customId === "enabled") {
await client.database.guilds.write(interaction.guild.id, { "tickets.enabled": !data.enabled })
data.enabled = !data.enabled;