Don't attempt to create a reply embed when message fetching fails

This commit is contained in:
Ske 2021-01-14 03:21:56 +01:00
parent 1c4b972f65
commit e0cc74a712

View File

@ -102,9 +102,14 @@ namespace PluralKit.Bot
if (trigger.Reference?.Channel?.Id == trigger.ChannelId)
{
var repliedTo = await FetchReplyOriginalMessage(trigger.Reference);
var embed = await CreateReplyEmbed(repliedTo);
if (embed != null)
embeds.Add(embed);
if (repliedTo != null)
{
var embed = CreateReplyEmbed(repliedTo);
if (embed != null)
embeds.Add(embed);
}
// TODO: have a clean error for when message can't be fetched instead of just being silent
}
// Send the webhook
@ -137,7 +142,7 @@ namespace PluralKit.Bot
return null;
}
private async Task<DiscordEmbed> CreateReplyEmbed(DiscordMessage original)
private DiscordEmbed CreateReplyEmbed(DiscordMessage original)
{
var content = new StringBuilder();