feat: Lyrics mode #109
2 changed files with 48 additions and 8 deletions
|
@ -21,6 +21,14 @@ export default {
|
||||||
.setNameLocalizations(getLocalizations(client, `c_${filename}_name`, true))
|
.setNameLocalizations(getLocalizations(client, `c_${filename}_name`, true))
|
||||||
.setDescriptionLocalizations(getLocalizations(client, `c_${filename}_desc`))
|
.setDescriptionLocalizations(getLocalizations(client, `c_${filename}_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
|
// Command option
|
||||||
.addStringOption((option) =>
|
.addStringOption((option) =>
|
||||||
option
|
option
|
||||||
|
@ -29,6 +37,25 @@ export default {
|
||||||
.setNameLocalizations(getLocalizations(client, `c_${filename}_opt1_name`, true))
|
.setNameLocalizations(getLocalizations(client, `c_${filename}_opt1_name`, true))
|
||||||
.setDescriptionLocalizations(getLocalizations(client, `c_${filename}_opt1_desc`))
|
.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 loc = getLocale(client, interaction.locale);
|
||||||
|
|
||||||
const request = interaction.options.getString(
|
let request = interaction.options.getString(
|
||||||
loc_default?.get(`c_${filename}_opt1_name`) as string
|
loc_default?.get(`c_${filename}_opt1_name`) as string
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -47,6 +74,15 @@ export default {
|
||||||
|
|
||||||
const player = useMainPlayer() as Player;
|
const player = useMainPlayer() as Player;
|
||||||
if (request) {
|
if (request) {
|
||||||
|
if (
|
||||||
|
interaction.options.getSubcommand() ==
|
||||||
|
loc_default?.get(`c_${filename}_sub2_name`)?.toLowerCase() ??
|
||||||
|
""
|
||||||
|
) {
|
||||||
|
// Romanized
|
||||||
|
request += " romanized";
|
||||||
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
data = await player.lyrics.search(request);
|
data = await player.lyrics.search(request);
|
||||||
} catch {
|
} catch {
|
||||||
|
|
|
@ -137,6 +137,10 @@
|
||||||
|
|
||||||
"c_lyrics_name": "paroles",
|
"c_lyrics_name": "paroles",
|
||||||
"c_lyrics_desc": "Affiche les paroles d'une chanson",
|
"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 romanisée (ex: hangul -> latin)",
|
||||||
"c_lyrics_opt1_name": "chanson",
|
"c_lyrics_opt1_name": "chanson",
|
||||||
"c_lyrics_opt1_desc": "Chanson recherchée",
|
"c_lyrics_opt1_desc": "Chanson recherchée",
|
||||||
"c_lyrics1": "Le bot ne joue rien en ce moment et aucune chanson n'est renseignée.",
|
"c_lyrics1": "Le bot ne joue rien en ce moment et aucune chanson n'est renseignée.",
|
||||||
|
|
Loading…
Reference in a new issue