diff --git a/src/commands/game/wouldyourather.ts b/src/commands/game/wouldyourather.ts index 7718dbd6..b6c5fef7 100644 --- a/src/commands/game/wouldyourather.ts +++ b/src/commands/game/wouldyourather.ts @@ -1,15 +1,15 @@ import { - EmbedBuilder, SlashCommandBuilder, ActionRowBuilder, ButtonBuilder, MessageActionRowComponentBuilder, - bold, } from "discord.js"; import shuffle from "../../util/shuffle"; import { captureException } from "@sentry/node"; import { ChatInputCommand } from "../../models"; import { getWouldYouRather } from "../../util/Functions/jsonImport"; +import { DefaultGameEmbed } from "../../util/Defaults/Embeds/Games/DefaultGameEmbed"; + const command: ChatInputCommand = { requireGuild: true, @@ -57,13 +57,7 @@ const command: ChatInputCommand = { const Random = Math.floor(Math.random() * wouldyourather.length); - let ratherembed = new EmbedBuilder() - .setColor("#0598F6") - .setFooter({ - text: `Requested by ${interaction.user.username} | Type: WYR | ID: ${Random}`, - iconURL: interaction.user.displayAvatarURL() || undefined, - }) - .setDescription(bold(wouldyourather[Random])); + const ratherembed = new DefaultGameEmbed(interaction, Random, wouldyourather, "wyr") const mainRow = new ActionRowBuilder(); if (Math.round(Math.random() * 15) < 3) { diff --git a/src/util/Defaults/Embeds/Games/DefaultGameEmbed.ts b/src/util/Defaults/Embeds/Games/DefaultGameEmbed.ts new file mode 100644 index 00000000..cc1bd937 --- /dev/null +++ b/src/util/Defaults/Embeds/Games/DefaultGameEmbed.ts @@ -0,0 +1,28 @@ +import { bold, EmbedBuilder, CommandInteraction } from "discord.js"; + +export class DefaultGameEmbed extends EmbedBuilder { + constructor( + interaction: CommandInteraction, + Random: number, + question: Array, + type: string, + ) { + super(); + + const TypeMap: Map = new Map([ + ["wyr", "WYR"], + ["nhie", "NHIE"], + ["wwyd", "WWYD"], + ["truth", "TRUTH"], + ["dare", "DARE"] + ]); + + this.setColor("#0598F6"); + this.setFooter({ + text: `Requested by ${interaction.user.username} | Type: ${TypeMap.get(type)} | ID: ${Random}`, + iconURL: interaction.user.displayAvatarURL() || undefined, + }); + this.setDescription(bold(question[Random])); + + } +} diff --git a/src/util/Models/command b/src/util/Models/command new file mode 100644 index 00000000..e69de29b