예제 #1
0
        public async Task RemoveAchievementCommand(
            [Summary("The name, UUID or Discord message ID of the achievement.")] string achievement,
            [Remainder][Summary("The player to revoke the achievement from.")] string players
        ) {
            var achv = Program.Controller.Achievements.FindAchievement(achievement);
            if (achv == null) {
                await ReplyAsync(EmbedHelper.GenerateErrorEmbed($"Could not find the achievement from the query **{achievement}**."));
                return;
            }

            var teams = TournamentCommands.StrListToTeams(players);

            var output = "";
            foreach (var t in teams) {
                foreach (var p in t.Players) {
                    if (await achv.AddPlayer(p)) {
                        output += p.IGN + Environment.NewLine;
                    }
                    else {
                        await ReplyAsync(EmbedHelper.GenerateWarnEmbed($"Could not revoke the player **{p.IGN}** of the achievement **{achv.Name}**."));
                    }
                }
            }

            await ReplyAsync(EmbedHelper.GenerateSuccessEmbed(
                $"Successfully revoked the following players of the achievement **{achv.Name}**:" + Environment.NewLine + Environment.NewLine + output));
        }