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 d0db3de7cf - Show all commits

View file

@ -81,7 +81,7 @@ export default async (message: Message, client: Client) => {
const loc = getLocale(client, client.config.default_lang);
// Remove duplicates
// Remove duplicates then map the quoted posts
[...new Set(messages)].map(quoted_post => {
const embed = new MessageEmbed()
.setColor('#2f3136')
@ -104,7 +104,10 @@ export default async (message: Message, client: Client) => {
`[${file.name}](${file.url}), `
);
embed.addFields({
// TODO: Don't pluralize when there is only one file.
name: 'Fichiers joints',
// TODO: Check if don't exceed char limit, if yes, split
// files into multiples field.
value: `${files.slice(0, -2)}.`,
});
}
@ -145,13 +148,14 @@ export default async (message: Message, client: Client) => {
iconURL: message.author.avatarURL() ?? undefined,
});
// Location and author of the post
// Location/author of the quoted post
embed.addField(author, `${quoted_post?.author}`, true);
embed.addField(
'Message', `${quoted_post?.channel} - [Lien Message](${quoted_post?.url})`,
true
);
// Delete source message if no content when removing links
if (
!message.content.replace(new RegExp(regex, 'g'), '').trim() &&
messages.length === urls.length &&