Skip to content

Commit

Permalink
fix: add defauls embeds
Browse files Browse the repository at this point in the history
  • Loading branch information
Dominik K committed Dec 5, 2023
1 parent a0d4288 commit fff2c53
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 9 deletions.
12 changes: 3 additions & 9 deletions src/commands/game/wouldyourather.ts
Original file line number Diff line number Diff line change
@@ -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,
Expand Down Expand Up @@ -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<MessageActionRowComponentBuilder>();
if (Math.round(Math.random() * 15) < 3) {
Expand Down
28 changes: 28 additions & 0 deletions src/util/Defaults/Embeds/Games/DefaultGameEmbed.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import { bold, EmbedBuilder, CommandInteraction } from "discord.js";

export class DefaultGameEmbed extends EmbedBuilder {
constructor(
interaction: CommandInteraction,
Random: number,
question: Array<string>,
type: string,
) {
super();

const TypeMap: Map<string, string> = 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]));

}
}
Empty file added src/util/Models/command
Empty file.

0 comments on commit fff2c53

Please sign in to comment.