private void UpdateReactions() { foreach (var reaction in Message.Reactions) { if (!Reactions.Contains(reaction)) { _context.Post((o) => Reactions.Add(reaction), null); } } foreach (var reaction in Reactions.ToList()) { if (!Message.Reactions.Contains(reaction)) { _context.Post((o) => Reactions.Remove(reaction), null); } } }
private async void DeleteReactionCommand(ReactionInfo deleteThis) { try { OutputMessages.Add(new OutputMessage { Message = "Deleting reaction(s)...", Level = "debug" }); _logService.Write(this, "Deleting reaction(s)...", "debug"); await _dbService.DeleteReaction(deleteThis.ReactionID); Reactions.Remove(deleteThis); OutputMessages.Add(new OutputMessage { Message = "Reaction(s) deleted!", Level = "debug" }); _logService.Write(this, "Deleting reaction(s)...", "debug"); } catch (Exception e) { OutputMessages.Add(new OutputMessage { Message = e.Message, Level = "fatal" }); _logService.Write(this, e.Message, "fatal"); } }