WIP embed

This commit is contained in:
Mylloon 2022-07-27 00:03:56 +02:00
parent 1349ad52bb
commit a5b6924ddc
Signed by: Anri
GPG key ID: A82D63DFF8D1317F

View file

@ -1,7 +1,9 @@
import { Message, TextBasedChannel } from 'discord.js';
import { Client, Message, MessageEmbed, TextBasedChannel } from 'discord.js';
import { getLocale } from '../../utils/locales';
import { showDate } from '../../utils/time';
/** https://discord.js.org/#/docs/discord.js/main/class/Client?scrollTo=e-messageCreate */
export default async (message: Message) => {
export default async (message: Message, client: Client) => {
// Ignore message if
if (
// Author is a bot
@ -73,4 +75,21 @@ export default async (message: Message) => {
// Remove undefined elements
).filter(Boolean);
messages.map(valid_message => {
const embed = new MessageEmbed()
.setColor('#2f3136')
.setAuthor({
name: 'Citation',
iconURL: valid_message?.author.displayAvatarURL(),
})
.setFooter({
text: `Message posté le ${showDate(
client.config.default_lang,
getLocale(client, client.config.default_lang),
valid_message?.createdAt as Date)
}`,
});
return message.channel.send({ embeds: [embed] });
});
};