Skip to content

Commit

Permalink
Add DOs and DON'Ts to support ticket guide
Browse files Browse the repository at this point in the history
  • Loading branch information
Rian8337 committed Feb 8, 2024
1 parent bbcbdaf commit 69ada38
Show file tree
Hide file tree
Showing 9 changed files with 107 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,7 @@ export const run: ButtonCommand["run"] = async (_, interaction) => {

embed
.setTitle(localization.getTranslation("embedTitle"))
.setDescription(
localization.getTranslation("howToCreateTicket") +
"\n\n" +
localization.getTranslation("includeDetails"),
);
.setDescription(localization.getTranslation("howToCreateTicket"));

InteractionHelper.update(interaction, {
embeds: [embed],
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
import { SupportTicketGuideDosDontsLocalization } from "@alice-localization/interactions/buttons/Support Ticket Guide/supportTicketGuideDosDonts/SupportTicketGuideDosDontsLocalization";
import { ButtonCommand } from "@alice-structures/core/ButtonCommand";
import { EmbedCreator } from "@alice-utils/creators/EmbedCreator";
import { createSupportTicketGuideButton } from "@alice-utils/creators/SupportTicketGuideButtonCreator";
import { CommandHelper } from "@alice-utils/helpers/CommandHelper";
import { InteractionHelper } from "@alice-utils/helpers/InteractionHelper";
import { unorderedList } from "discord.js";

export const run: ButtonCommand["run"] = async (_, interaction) => {
if (!interaction.inCachedGuild()) {
return;
}

const language = await CommandHelper.getLocale(interaction);
const localization = new SupportTicketGuideDosDontsLocalization(language);

const embed = EmbedCreator.createNormalEmbed({
author: interaction.user,
color: interaction.member.displayColor,
});

embed
.setTitle(localization.getTranslation("embedTitle"))
.setDescription(
localization.getTranslation("createTicketDosHeader") +
"\n" +
unorderedList([
localization.getTranslation("createTicketDos1"),
localization.getTranslation("createTicketDos2"),
]) +
"\n\n" +
localization.getTranslation("createTicketDontsHeader") +
"\n" +
unorderedList([
localization.getTranslation("createTicketDonts1"),
localization.getTranslation("createTicketDonts2"),
]),
);

InteractionHelper.update(interaction, {
embeds: [embed],
components: createSupportTicketGuideButton(
interaction.customId,
language,
),
});
};

export const config: ButtonCommand["config"] = {
replyEphemeral: true,
instantDeferInDebug: false,
};
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import { SupportTicketGuideCreationENTranslation } from "./translations/SupportT
export interface SupportTicketGuideCreationStrings {
readonly embedTitle: string;
readonly howToCreateTicket: string;
readonly includeDetails: string;
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,5 @@ export class SupportTicketGuideCreationENTranslation extends Translation<Support
override readonly translations: SupportTicketGuideCreationStrings = {
embedTitle: "Writing a Ticket",
howToCreateTicket: `To create a ticket, use the "Create Ticket" button above. Alternatively, you can use the ${chatInputApplicationCommandMention("ticket", "create", "1204482021511135315")} command.`,
includeDetails:
"Please include as much details as you can when writing a ticket. It will help staff members in assisting you.",
};
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import { Localization } from "@alice-localization/base/Localization";
import { Translations } from "@alice-localization/base/Translations";
import { SupportTicketGuideDosDontsENTranslation } from "./translations/SupportTicketGuideDosDontsENTranslation";

export interface SupportTicketGuideDosDontsStrings {
readonly embedTitle: string;
readonly createTicketDosHeader: string;
readonly createTicketDos1: string;
readonly createTicketDos2: string;
readonly createTicketDontsHeader: string;
readonly createTicketDonts1: string;
readonly createTicketDonts2: string;
}

/**
* Localizations for the `supportTicketGuideDosDonts` button command.
*/
export class SupportTicketGuideDosDontsLocalization extends Localization<SupportTicketGuideDosDontsStrings> {
protected override readonly localizations: Readonly<
Translations<SupportTicketGuideDosDontsStrings>
> = {
en: new SupportTicketGuideDosDontsENTranslation(),
};
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import { Translation } from "@alice-localization/base/Translation";
import { SupportTicketGuideDosDontsStrings } from "../SupportTicketGuideDosDontsLocalization";
import { Config } from "@alice-core/Config";
import { userMention, channelMention } from "discord.js";

/**
* The English translation for the `supportTicketGuideDosDonts` button command.
*/
export class SupportTicketGuideDosDontsENTranslation extends Translation<SupportTicketGuideDosDontsStrings> {
override readonly translations: SupportTicketGuideDosDontsStrings = {
embedTitle: "DOs and DON'Ts",
createTicketDosHeader: "DOs when creating a ticket:",
createTicketDos1:
"Include as much details as you can. It will help staff members in assisting you.",
createTicketDos2:
"Provide screenshots when necessary. This can be done after creating a ticket.",
createTicketDontsHeader: "DON'Ts when creating a ticket:",
createTicketDonts1: `Including your private information. Apart from ${userMention(Config.botOwners[1])}, ${userMention(Config.botOwners[0])}, and ${userMention("210769870848000001")}, no one in the staff team has access to your private information (excluding your password). Some ticket presets will ask your private information such as email, but these information can only be seen by ${userMention(Config.botOwners[1])} and ${userMention("210769870848000001")}. Should you require private information to be submitted, please move to the Direct Messages of one of those people instead.`,
createTicketDonts2: `Creating a ticket for game-related questions or bug reports. These matters should be posted in ${channelMention("1006369245577347082")} instead.`,
};
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ export interface SupportTicketGuideButtonCreatorStrings {
readonly purposeButton: string;
readonly writingTicketButton: string;
readonly ticketPresetsButton: string;
readonly dosAndDontsButton: string;
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,6 @@ export class SupportTicketGuideButtonCreatorENTranslation extends Translation<Su
purposeButton: "Purpose",
writingTicketButton: "Writing a Ticket",
ticketPresetsButton: "Ticket Presets",
dosAndDontsButton: "DOs and DON'Ts",
};
}
7 changes: 7 additions & 0 deletions src/utils/creators/SupportTicketGuideButtonCreator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ export function createSupportTicketGuideButton(
const purposeButtonId = "supportTicketGuidePurpose";
const writingTicketButtonId = "supportTicketGuideCreation";
const ticketPresetsButtonId = "supportTicketGuidePresets";
const dosAndDontsButtonId = "supportTicketGuideDosDonts";

return [
new ActionRowBuilder<ButtonBuilder>().addComponents(
Expand Down Expand Up @@ -53,6 +54,12 @@ export function createSupportTicketGuideButton(
.setStyle(ButtonStyle.Secondary)
.setEmoji(Symbols.bookmarkTabs)
.setLabel(localization.getTranslation("ticketPresetsButton")),
new ButtonBuilder()
.setCustomId(dosAndDontsButtonId)
.setDisabled(currentCustomId === dosAndDontsButtonId)
.setStyle(ButtonStyle.Secondary)
.setEmoji(Symbols.bookmarkTabs)
.setLabel(localization.getTranslation("dosAndDontsButton")),
),
];
}

0 comments on commit 69ada38

Please sign in to comment.