Example #1
0
        public async Task Team()
        {
            MySqlConnection conn = DatabaseHelper.GetClosedConnection();

            if (!await conn.IsUserRegistered(Context.User.Id))
            {
                return;
            }

            IUserMessage msg;

            if (Private)
            {
                msg = await(await Context.User.GetOrCreateDMChannelAsync()).SendMessageAsync("Loading Data...");
            }
            else
            {
                msg = await Context.Channel.SendMessageAsync("Loading Data...");
            }

            Models.Team     t    = (await conn.GetXMLFromDatabaseAsync("Team", "Trainers", Context.User.Id)).Deserialize <Models.Team>();
            Models.Pokemon  p    = t.First();
            PokeAPI.Pokemon pApi = await DataFetcher.GetApiObject <PokeAPI.Pokemon>(p.ID);

            EmbedBuilder builder = new EmbedBuilder()
            {
                Title        = $"{(Context.User as IGuildUser).Nickname ?? Context.User.Username}'s {p.Nickname ?? pApi.Name.Capatalize()}",
                Color        = Color.Teal,
                Description  = p.ToString(pApi.Name),
                ThumbnailUrl = $"https://img.pokemondb.net/sprites/black-white/anim/normal/{pApi.Name}.gif"
            };

            await msg.ModifyAsync(x => { x.Content = ""; x.Embed = builder.Build(); });
        }
Example #2
0
        private async Task <EmbedBuilder> GetFirstPokemon()
        {
            Models.Team     t    = (await DatabaseHelper.GetClosedConnection().GetXMLFromDatabaseAsync("Team", "Trainers", Context.User.Id)).Deserialize <Models.Team>();
            Models.Pokemon  p    = t.First();
            PokeAPI.Pokemon pApi = await DataFetcher.GetApiObject <PokeAPI.Pokemon>(p.ID);

            EmbedBuilder builder = new EmbedBuilder()
            {
                Title        = $"{(Context.User as IGuildUser).Nickname ?? Context.User.Username}'s {p.Nickname ?? pApi.Name.Capatalize()}",
                Color        = Color.Teal,
                Description  = p.ToString(pApi.Name),
                ThumbnailUrl = $"https://img.pokemondb.net/sprites/black-white/anim/normal/{pApi.Name}.gif"
            };

            return(builder);
        }