public async Task <RuntimeResult> Privacy() { string listToShow = ""; string[] configList = Locate("PrivacyConfigList").Split(new[] { "\r\n", "\n", "\r" }, StringSplitOptions.None); for (int i = 0; i < configList.Length; i++) { listToShow += $"**{i + 1}.** {configList[i]}\n"; } var userConfig = GuildUtils.UserConfigCache.GetValueOrDefault(Context.User.Id, new UserConfig(Context.User.Id)); string valueList = Locate(userConfig !.IsOptedOutSnipe); IUserMessage message = null; var builder = new EmbedBuilder() .WithTitle(Locate("PrivacyPolicy")) .AddField(Locate("WhatDataWeCollect"), Locate("WhatDataWeCollectList")) .AddField(Locate("WhenWeCollectData"), Locate("WhenWeCollectDataList")) .AddField(Locate("PrivacyConfig"), Locate("PrivacyConfigInfo")) .AddField(Locate("Option"), listToShow, true) .AddField(Locate("Value"), valueList, true) .WithColor(FergunClient.Config.EmbedColor); var data = new ReactionCallbackData(null, builder.Build(), false, false, TimeSpan.FromMinutes(5)) .AddCallBack(new Emoji("1️⃣"), async(_, reaction) => { userConfig.IsOptedOutSnipe = !userConfig.IsOptedOutSnipe; await HandleReactionAsync(reaction); }) .AddCallBack(new Emoji("❌"), async(_, reaction) => { await message.TryDeleteAsync(); }); message = await InlineReactionReplyAsync(data); return(FergunResult.FromSuccess()); async Task HandleReactionAsync(SocketReaction reaction) { FergunClient.Database.InsertOrUpdateDocument(Constants.UserConfigCollection, userConfig); GuildUtils.UserConfigCache[Context.User.Id] = userConfig; valueList = Locate(userConfig.IsOptedOutSnipe); if (reaction.Emote.Name == "1️⃣" && userConfig.IsOptedOutSnipe) { var toPurge = FergunClient.MessageCache.Where(p => p.Value.Author.Id == reaction.UserId).ToList(); var removed = toPurge.Count(p => FergunClient.MessageCache.TryRemove(p.Key, out _)); if (removed > 0) { await _logService.LogAsync(new LogMessage(LogSeverity.Verbose, "Command", $"Privacy: Removed {removed} deleted/edited messages from the cache from user {reaction.UserId}.")); } } builder.Fields[4] = new EmbedFieldBuilder { Name = Locate("Value"), Value = valueList, IsInline = true }; _ = message !.RemoveReactionAsync(reaction.Emote, reaction.UserId); await message.ModifyAsync(x => x.Embed = builder.Build()); } }