diff --git a/src/assets/exit_map.jpg b/src/assets/exit_map.jpg new file mode 100644 index 0000000..5224aad Binary files /dev/null and b/src/assets/exit_map.jpg differ diff --git a/src/assets/venue_map.jpg b/src/assets/venue_map.jpg new file mode 100644 index 0000000..d267415 Binary files /dev/null and b/src/assets/venue_map.jpg differ diff --git a/src/commands/map.ts b/src/commands/map.ts new file mode 100644 index 0000000..e06e7af --- /dev/null +++ b/src/commands/map.ts @@ -0,0 +1,71 @@ +import { SlashCommandBuilder } from "@discordjs/builders"; +import { MessageEmbed, MessageAttachment } from "discord.js"; +import { Command } from "../interfaces/Command"; + +export const map: Command = { + data: new SlashCommandBuilder() + .setName("map") + .setDescription("Provides venue and exit plan maps") + .addStringOption((option) => + option + .setName("map") + .setDescription("Enter either 'venue' or 'exit'") + .setRequired(true) + ), + run: async (interaction, client) => { + await interaction.deferReply(); + + let iconURL: string | null | undefined; + if (client.user?.avatarURL({ format: "png" }) === null) { + iconURL = "https://avatars.githubusercontent.com/u/107168679?s=200&v=4"; + } else { + iconURL = client.user?.avatarURL({ format: "png" }); + } + + let file: MessageAttachment; + let mapEmbed: MessageEmbed; + + switch(interaction.options.getString("map", true)) { + case "venue": { + file = new MessageAttachment('src/assets/venue_map.jpg'); + mapEmbed = new MessageEmbed() + .setColor("#ffeded") + .setTitle("Venue Map") + .setTimestamp() + .setImage("attachment://venue_map.jpg") + .setFooter({ + text: `${client.user?.tag}`, + iconURL: iconURL as string, + }) + await interaction.editReply({ embeds: [mapEmbed], files: [file] }); + break; + } + case "exit": { + file = new MessageAttachment('src/assets/exit_map.jpg'); + mapEmbed = new MessageEmbed() + .setColor("#ffeded") + .setTitle("Venue Map") + .setTimestamp() + .setImage("attachment://exit_map.jpg") + .setFooter({ + text: `${client.user?.tag}`, + iconURL: iconURL as string, + }) + await interaction.editReply({ embeds: [mapEmbed], files: [file] }); + break; + } + default: { + mapEmbed = new MessageEmbed() + .setColor("#ffeded") + .setTitle("Option not found") + .setTimestamp() + .setFooter({ + text: `${client.user?.tag}`, + iconURL: iconURL as string, + }) + await interaction.editReply({ embeds: [mapEmbed] }); + break; + } + } + } +} diff --git a/src/utils/_Commandlists.ts b/src/utils/_Commandlists.ts index 3792f52..547a05c 100644 --- a/src/utils/_Commandlists.ts +++ b/src/utils/_Commandlists.ts @@ -1,5 +1,6 @@ import { Command } from "../interfaces/Command"; import { help } from "../commands/help"; import { report } from "../commands/report"; +import { map } from "../commands/map"; -export const CommandList: Command[] = [help, report]; +export const CommandList: Command[] = [help, report, map];