Example #1
0
        public async Task Deck(string argument = null, params string[] deckNames)
        {
            GameContext context = GameContexts.getContext(Context.Guild.Id);

            switch (argument)
            {
            case "add":
                context.AddDecks(deckNames);
                context.SaveToJson();
                break;

            case "remove":
                context.RemoveDecks(deckNames);
                context.SaveToJson();
                break;

            default:
                if (context.UsedDecks.Count > 0)
                {
                    EmbedBuilder embed = new EmbedBuilder();

                    EmbedFieldBuilder usedField = new EmbedFieldBuilder();
                    usedField.WithName("Current Decks");
                    string description = string.Empty;
                    foreach (Deck deck in context.UsedDecks)
                    {
                        description += string.Format("{2} {0} - {1}" + Environment.NewLine, deck.Name, deck.Description, deck.Emoji);
                    }
                    usedField.WithValue(description);

                    EmbedFieldBuilder unusedField = new EmbedFieldBuilder();
                    unusedField.WithName("Avaliable Decks");
                    description = string.Empty;
                    List <Deck> unusedDecks = (List <Deck>)Decks.GetAllDecks();
                    unusedDecks.RemoveAll(s => context.UsedDecks.Contains(s));
                    foreach (Deck deck in unusedDecks)
                    {
                        description += string.Format("{2} {0} - {1}" + Environment.NewLine, deck.Name, deck.Description, deck.Emoji);
                    }
                    unusedField.WithValue(description);

                    embed.AddField(usedField);
                    embed.AddField(unusedField);

                    await ReplyAsync("", false, embed.Build());
                }
                else
                {
                    await ReplyAsync("You currently have no decks.");
                }

                break;
            }
        }