private async Task HandleReactionAsync(ICacheable <IUserMessage, ulong> cachedMessage, IReaction reaction) { var emote = reaction.Emote; if (!_starboardService.IsStarEmote(emote)) { return; } var message = await cachedMessage.GetOrDownloadAsync(); if (!(message.Channel is IGuildChannel channel)) { return; } var isIgnoredFromStarboard = await _designatedChannelService .ChannelHasDesignationAsync(channel.Guild, channel, DesignatedChannelType.IgnoredFromStarboard); var starboardExists = await _designatedChannelService .AnyDesignatedChannelAsync(channel.GuildId, DesignatedChannelType.Starboard); if (isIgnoredFromStarboard || !starboardExists) { return; } var reactionCount = await _starboardService.GetReactionCount(message, emote); if (await _starboardService.ExistsOnStarboard(message)) { if (_starboardService.IsAboveReactionThreshold(reactionCount)) { await _starboardService.ModifyEntry(channel.Guild, message, FormatContent(reactionCount), GetEmbedColor(reactionCount)); } else { await _starboardService.RemoveFromStarboard(channel.Guild, message); } } else if (_starboardService.IsAboveReactionThreshold(reactionCount)) { var embed = GetStarEmbed(message, GetEmbedColor(reactionCount)); await _starboardService.AddToStarboard(channel.Guild, message, FormatContent(reactionCount), embed); } }