embed + localization on track start
All checks were successful
ci/woodpecker/push/publish Pipeline was successful
All checks were successful
ci/woodpecker/push/publish Pipeline was successful
This commit is contained in:
parent
7b076377c3
commit
dfe7618530
3 changed files with 25 additions and 3 deletions
|
@ -1,7 +1,21 @@
|
||||||
|
import { EmbedBuilder } from "@discordjs/builders";
|
||||||
import { Queue, Track } from "discord-player";
|
import { Queue, Track } from "discord-player";
|
||||||
|
import { Client } from "discord.js";
|
||||||
import { Metadata } from "../../utils/metadata";
|
import { Metadata } from "../../utils/metadata";
|
||||||
|
import { emojiPng } from "../../utils/misc";
|
||||||
|
|
||||||
/** https://discord-player.js.org/docs/main/master/typedef/PlayerEvents */
|
/** https://discord-player.js.org/docs/main/master/typedef/PlayerEvents */
|
||||||
export default (queue: Queue<Metadata>, track: Track) => {
|
export default (queue: Queue<Metadata>, track: Track, client: Client) => {
|
||||||
queue.metadata?.channel?.send(`🎶 | Joue \`${track.title}\` demandé par ${track.requestedBy}.`);
|
const loc_default = client.locales.get(client.config.default_lang);
|
||||||
|
|
||||||
|
const embed = new EmbedBuilder()
|
||||||
|
.setDescription(`${loc_default?.get("e_trackstart1")} ${track.requestedBy}`)
|
||||||
|
.setTitle(track.title)
|
||||||
|
.setURL(track.url)
|
||||||
|
.setThumbnail(track.thumbnail)
|
||||||
|
.setFooter({
|
||||||
|
text: `${loc_default?.get("e_trackstart2")} ${track.duration} via ${track.source}`,
|
||||||
|
iconURL: emojiPng("🎶"),
|
||||||
|
});
|
||||||
|
queue.metadata?.channel?.send({ embeds: [embed] });
|
||||||
};
|
};
|
||||||
|
|
|
@ -153,5 +153,8 @@
|
||||||
"c_repeat3": "Répétition de la file d'attente",
|
"c_repeat3": "Répétition de la file d'attente",
|
||||||
"c_repeat4": "Lecture automatique",
|
"c_repeat4": "Lecture automatique",
|
||||||
"c_repeat5": "Répétition de la chanson",
|
"c_repeat5": "Répétition de la chanson",
|
||||||
"c_repeat6": "activé."
|
"c_repeat6": "activé.",
|
||||||
|
|
||||||
|
"e_trackstart1": "Demandé par",
|
||||||
|
"e_trackstart2": "Durée :"
|
||||||
}
|
}
|
||||||
|
|
|
@ -102,3 +102,8 @@ export const cleanCodeBlock = (text: string) => {
|
||||||
|
|
||||||
return text;
|
return text;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
export const emojiPng = (emoji: string) =>
|
||||||
|
`https://cdn.jsdelivr.net/gh/twitter/twemoji/assets/72x72/${emoji
|
||||||
|
.codePointAt(0)
|
||||||
|
?.toString(16)}.png`;
|
||||||
|
|
Loading…
Reference in a new issue