diff --git a/src/commands/music/lyrics.ts b/src/commands/music/lyrics.ts index d526252..2402624 100644 --- a/src/commands/music/lyrics.ts +++ b/src/commands/music/lyrics.ts @@ -21,13 +21,40 @@ export default { .setNameLocalizations(getLocalizations(client, `c_${filename}_name`, true)) .setDescriptionLocalizations(getLocalizations(client, `c_${filename}_desc`)) - // Command option - .addStringOption((option) => - option - .setName(loc_default.get(`c_${filename}_opt1_name`)?.toLowerCase() ?? "") - .setDescription(loc_default.get(`c_${filename}_opt1_desc`) ?? "") - .setNameLocalizations(getLocalizations(client, `c_${filename}_opt1_name`, true)) - .setDescriptionLocalizations(getLocalizations(client, `c_${filename}_opt1_desc`)) + // Normal + .addSubcommand((subcommand) => + subcommand + .setName(loc_default.get(`c_${filename}_sub1_name`)?.toLowerCase() ?? "") + .setDescription(loc_default.get(`c_${filename}_sub1_desc`) ?? "") + .setNameLocalizations(getLocalizations(client, `c_${filename}_sub1_name`, true)) + .setDescriptionLocalizations(getLocalizations(client, `c_${filename}_sub1_desc`)) + + // Command option + .addStringOption((option) => + option + .setName(loc_default.get(`c_${filename}_opt1_name`)?.toLowerCase() ?? "") + .setDescription(loc_default.get(`c_${filename}_opt1_desc`) ?? "") + .setNameLocalizations(getLocalizations(client, `c_${filename}_opt1_name`, true)) + .setDescriptionLocalizations(getLocalizations(client, `c_${filename}_opt1_desc`)) + ) + ) + + // Romanized + .addSubcommand((subcommand) => + subcommand + .setName(loc_default.get(`c_${filename}_sub2_name`)?.toLowerCase() ?? "") + .setDescription(loc_default.get(`c_${filename}_sub2_desc`) ?? "") + .setNameLocalizations(getLocalizations(client, `c_${filename}_sub2_name`, true)) + .setDescriptionLocalizations(getLocalizations(client, `c_${filename}_sub2_desc`)) + + // Command option + .addStringOption((option) => + option + .setName(loc_default.get(`c_${filename}_opt1_name`)?.toLowerCase() ?? "") + .setDescription(loc_default.get(`c_${filename}_opt1_desc`) ?? "") + .setNameLocalizations(getLocalizations(client, `c_${filename}_opt1_name`, true)) + .setDescriptionLocalizations(getLocalizations(client, `c_${filename}_opt1_desc`)) + ) ) ); }, @@ -38,7 +65,7 @@ export default { const loc = getLocale(client, interaction.locale); - const request = interaction.options.getString( + let request = interaction.options.getString( loc_default?.get(`c_${filename}_opt1_name`) as string ); @@ -47,6 +74,15 @@ export default { const player = useMainPlayer() as Player; if (request) { + if ( + interaction.options.getSubcommand() == + loc_default?.get(`c_${filename}_sub2_name`)?.toLowerCase() ?? + "" + ) { + // Romanized + request += " romanized"; + } + try { data = await player.lyrics.search(request); } catch { diff --git a/src/locales/fr.json b/src/locales/fr.json index b634f29..7e0da9a 100644 --- a/src/locales/fr.json +++ b/src/locales/fr.json @@ -137,6 +137,10 @@ "c_lyrics_name": "paroles", "c_lyrics_desc": "Affiche les paroles d'une chanson", + "c_lyrics_sub1_name": "normal", + "c_lyrics_sub1_desc": "Recherche de paroles", + "c_lyrics_sub2_name": "romanized", + "c_lyrics_sub2_desc": "Recherche de paroles \"romanized\"", "c_lyrics_opt1_name": "chanson", "c_lyrics_opt1_desc": "Chanson recherchée", "c_lyrics1": "Le bot ne joue rien en ce moment et aucune chanson n'est renseignée.",