Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added venue and exit map commands #15

Merged
merged 9 commits into from
Jun 16, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added src/assets/exit_map.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/assets/venue_map.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
71 changes: 71 additions & 0 deletions src/commands/map.ts
Original file line number Diff line number Diff line change
@@ -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;
}
}
}
}
3 changes: 2 additions & 1 deletion src/utils/_Commandlists.ts
Original file line number Diff line number Diff line change
@@ -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];