fix: only send expanded message link if present

Signed-off-by: Sefa Eyeoglu <contact@scrumplex.net>
This commit is contained in:
Sefa Eyeoglu 2023-05-20 11:50:22 +02:00
parent 450b28fbdf
commit 30b5293477
No known key found for this signature in database
GPG key ID: E13DFD4B47127951

View file

@ -83,22 +83,24 @@ export async function expandDiscordLink(message: Message): Promise<void> {
} }
} }
const reply = await message.reply({ if (resultEmbeds) {
embeds: resultEmbeds, const reply = await message.reply({
allowedMentions: { repliedUser: false }, embeds: resultEmbeds,
}); allowedMentions: { repliedUser: false },
});
const collector = new ReactionCollector(reply, { const collector = new ReactionCollector(reply, {
filter: (reaction) => { filter: (reaction) => {
return reaction.emoji.name === '❌'; return reaction.emoji.name === '❌';
}, },
time: 5 * 60 * 1000, time: 5 * 60 * 1000,
}); });
collector.on('collect', async (_, user) => { collector.on('collect', async (_, user) => {
if (user === message.author) { if (user === message.author) {
await reply.delete(); await reply.delete();
collector.stop(); collector.stop();
} }
}); });
}
} }