Skip to content

Commit

Permalink
Merge pull request #313 from the-hideout/fix-map-command
Browse files Browse the repository at this point in the history
Fix /map command
  • Loading branch information
Razzmatazzz authored Sep 16, 2024
2 parents f874077 + cdd092d commit 2b873c1
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions commands/map.mjs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { SlashCommandBuilder } from 'discord.js';

import gameData from '../modules/game-data.mjs';
import { getFixedT, getCommandLocalizations } from '../modules/translations.mjs';
import { getCommandLocalizations } from '../modules/translations.mjs';
import progress from '../modules/progress-shard.mjs';
import createEmbed from '../modules/create-embed.mjs';

Expand All @@ -23,18 +23,16 @@ const defaultFunction = {
async execute(interaction) {
await interaction.deferReply();
const { lang, gameMode } = await progress.getInteractionSettings(interaction);
const t = getFixedT(lang);
const commandT = getFixedT(lang, 'command');
const mapId = interaction.options.getString('map');

const [maps, items] = await Promise.all([
gameData.maps.getAll({lang, gameMode}),
gameData.items.getAll({lang, gameMode}),
]);

const selectedMapData = mapData.find(mapObject => mapObject.id === mapId);
const map = maps.find(m => m.id === mapId);

const embed = await createEmbed.map(selectedMapData, interaction, {items, maps, interactionOptions: {lang, gameMode}});
const embed = await createEmbed.map(map, interaction, {items, maps, interactionOptions: {lang, gameMode}});

return interaction.editReply({
embeds: [embed],
Expand Down

0 comments on commit 2b873c1

Please sign in to comment.