Esempio n. 1
0
        public async Task RemooveWarnAsync(SocketUser user, int index)
        {
            ModerationFunctions.CheckDirectories(Context.Guild);
            if (File.Exists("/home/bob_the_daniel/Data/" + Context.Guild.OwnerId + "/Infractions/Discord/" + user.Id))
            {
                List <Infraction> infractions = ModerationFunctions.LoadInfractions(Context.Guild.OwnerId + "/Infractions/Discord/" + user.Id);

                if (infractions.Count < index || index <= 0)
                {
                    await ReplyAsync("invalid infraction number");
                }
                else if (infractions.Count == 1)
                {
                    await ReplyAsync("removed " + user.Username + "'s warning for " + infractions[index - 1].reason);

                    File.Delete("/home/bob_the_daniel/Data/" + Context.Guild.OwnerId + "/Infractions/Discord/" + user.Id);
                }
                else
                {
                    string reason = infractions[index - 1].reason;
                    infractions.RemoveAt(index - 1);

                    ModerationFunctions.SaveInfractions(Context.Guild.OwnerId + "/Infractions/Discord/" + user.Id, infractions);

                    await ReplyAsync("removed " + user.Mention + "'s warning for " + reason);
                }
            }
            else
            {
                await ReplyAsync(user.Username + " has no warns");
            }
        }