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({
embeds: resultEmbeds,
allowedMentions: { repliedUser: false },
});
if (resultEmbeds) {
const reply = await message.reply({
embeds: resultEmbeds,
allowedMentions: { repliedUser: false },
});
const collector = new ReactionCollector(reply, {
filter: (reaction) => {
return reaction.emoji.name === '❌';
},
time: 5 * 60 * 1000,
});
const collector = new ReactionCollector(reply, {
filter: (reaction) => {
return reaction.emoji.name === '❌';
},
time: 5 * 60 * 1000,
});
collector.on('collect', async (_, user) => {
if (user === message.author) {
await reply.delete();
collector.stop();
}
});
collector.on('collect', async (_, user) => {
if (user === message.author) {
await reply.delete();
collector.stop();
}
});
}
}