public async Task FlagQC(CommandContext ctx, [Description("ID of QC to flag.")] int id, [RemainingText, Description("The reason you believe it needs flagged.")] string flagReason = "") { Quickchat chat = _quickchats[id.ToString()]; DiscordEmbedBuilder embed; foreach (FlagEvent item in chat.Flags) { if (item.UserId == ctx.Member.Id) { item.Reason = flagReason; embed = StartEmbed($"Each user can only flag an item once. Updating your reason to `{flagReason}`"); string dateReason = DateTime.UtcNow.ToString(); embed.WithFooter(dateReason); await ctx.RespondAsync(embed); //return; } } //if (chat.Flags.ContainsKey(ctx.Member.Id)) //{ // chat.Flags[ctx.Member.Id] = flagReason; // await ctx.RespondAsync(StartEmbed($"Each user can only flag an item once. Updating your reason to `{flagReason}`")); //} // chat.Flags.Add(ctx.Member.Id, flagReason); //FlagEvent event = new FlagEvent(); embed = StartEmbed($"Flagging QC ID `{id}` with reason of `{flagReason}`. (F{chat.Flags.Count})"); chat.IsFlagged = true; string output = JsonConvert.SerializeObject(_quickchats); await File.WriteAllTextAsync(s_fileName, output); await ctx.RespondAsync(embed); }
public async Task GetQuickChatScript(CommandContext ctx, [Description("ID of Quick chat to get script for.")] int index) { // If we're disabled, let them know. And exit out. if (!_isEnabled) { return; } // trigger some typing on discord's side. // We're good to go... If we have an index, pull it up. index = Math.Abs(index); // is our index within bounds? if (index < _quickchats.Count) { // yes it is, give the script to them. Quickchat chat = _quickchats[index.ToString()]; await ctx.RespondAsync("```" + chat.ToString() + "```"); return; } // we couldn't find it... Oh well, let the end user know. await ctx.RespondAsync("The ID specified is out of bounds. 0-" + (_quickchats.Count - 1)); }