feat: quote #42

Merged
Anri merged 16 commits from feat/citation into main 2022-07-27 13:00:24 +02:00
Showing only changes of commit a5b6924ddc - Show all commits

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] });
});
};