diff --git a/src/events/player/trackStart.ts b/src/events/player/trackStart.ts index d8d4f29..02ae885 100644 --- a/src/events/player/trackStart.ts +++ b/src/events/player/trackStart.ts @@ -1,7 +1,21 @@ +import { EmbedBuilder } from "@discordjs/builders"; import { Queue, Track } from "discord-player"; +import { Client } from "discord.js"; import { Metadata } from "../../utils/metadata"; +import { emojiPng } from "../../utils/misc"; /** https://discord-player.js.org/docs/main/master/typedef/PlayerEvents */ -export default (queue: Queue, track: Track) => { - queue.metadata?.channel?.send(`🎶 | Joue \`${track.title}\` demandé par ${track.requestedBy}.`); +export default (queue: Queue, track: Track, client: Client) => { + 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] }); }; diff --git a/src/locales/fr.json b/src/locales/fr.json index c662026..1cd0a02 100644 --- a/src/locales/fr.json +++ b/src/locales/fr.json @@ -153,5 +153,8 @@ "c_repeat3": "Répétition de la file d'attente", "c_repeat4": "Lecture automatique", "c_repeat5": "Répétition de la chanson", - "c_repeat6": "activé." + "c_repeat6": "activé.", + + "e_trackstart1": "Demandé par", + "e_trackstart2": "Durée :" } diff --git a/src/utils/misc.ts b/src/utils/misc.ts index beac077..dd23171 100644 --- a/src/utils/misc.ts +++ b/src/utils/misc.ts @@ -102,3 +102,8 @@ export const cleanCodeBlock = (text: string) => { return text; }; + +export const emojiPng = (emoji: string) => + `https://cdn.jsdelivr.net/gh/twitter/twemoji/assets/72x72/${emoji + .codePointAt(0) + ?.toString(16)}.png`;