feat: Better message in music category #74

Merged
Anri merged 11 commits from prettify-music into main 2023-02-17 23:06:19 +01:00
3 changed files with 25 additions and 3 deletions
Showing only changes of commit dfe7618530 - Show all commits

View file

@ -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<Metadata>, track: Track) => {
queue.metadata?.channel?.send(`🎶 | Joue \`${track.title}\` demandé par ${track.requestedBy}.`);
export default (queue: Queue<Metadata>, 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] });
};

View file

@ -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 :"
}

View file

@ -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`;