-
-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #294 from the-hideout/game-modes
Support multiple game modes
- Loading branch information
Showing
25 changed files
with
1,205 additions
and
799 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
import { EmbedBuilder, SlashCommandBuilder } from 'discord.js'; | ||
|
||
import { getFixedT, getCommandLocalizations, comT } from '../modules/translations.mjs'; | ||
import progress from '../modules/progress-shard.mjs'; | ||
import gameData from '../modules/game-data.mjs'; | ||
|
||
const defaultFunction = { | ||
data: new SlashCommandBuilder() | ||
.setName('gamemode') | ||
.setDescription('Set the game mode (regular, PVE) for bot responses') | ||
.setNameLocalizations(getCommandLocalizations('gamemode')) | ||
.setDescriptionLocalizations(getCommandLocalizations('gamemode_desc')) | ||
.addStringOption(option => option | ||
.setName('gamemode') | ||
.setDescription('Game mode to use') | ||
.setNameLocalizations(getCommandLocalizations('gamemode')) | ||
.setDescriptionLocalizations(getCommandLocalizations('gamemode_option_desc')) | ||
.setRequired(true) | ||
.setChoices(...gameData.gameModes.choices()) | ||
), | ||
async execute(interaction) { | ||
const locale = await progress.getServerLanguage(interaction.guildId) || interaction.locale; | ||
const t = getFixedT(locale); | ||
const gameMode = interaction.options.getString('gamemode'); | ||
progress.setGameMode(interaction.user.id, gameMode); | ||
const gameModeT = comT(`game_mode_${gameMode}`, {lng: locale}); | ||
return interaction.reply({ | ||
content: `✅ ${t('Game mode set to {{gameMode}}.', {gameMode: gameModeT})}`, | ||
ephemeral: true | ||
}); | ||
}, | ||
}; | ||
|
||
export default defaultFunction; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.