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