feat: Lyrics mode #109

Merged
Anri merged 2 commits from feat/lyrics-mode into main 2023-11-08 00:10:03 +01:00
2 changed files with 48 additions and 8 deletions
Showing only changes of commit c5a58ac978 - Show all commits

View file

@ -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 {

View file

@ -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.",