async def select(self, ctx, *, pokemon: converters.PokemonConverter(accept_blank=False)): """Select a specific pokémon from your collection.""" if pokemon is None: return await ctx.send("Couldn't find that pokémon!") await self.bot.mongo.update_member( ctx.author, {"$set": {f"selected_id": pokemon.id}}, ) await ctx.send(f"You selected your level {pokemon.level} {pokemon.species}. No. {pokemon.idx}.")
async def moveitem( self, ctx, from_pokemon: converters.PokemonConverter, to_pokemon: converters.PokemonConverter = None, ): """Move a pokémon's held item.""" if to_pokemon is None: to_pokemon = from_pokemon converter = converters.PokemonConverter() from_pokemon = await converter.convert(ctx, "") if to_pokemon is None: return await ctx.send("Couldn't find that pokémon!") if from_pokemon is None or to_pokemon is None: return await ctx.send("Couldn't find that pokémon!") if from_pokemon.held_item is None: return await ctx.send("That pokémon isn't holding an item!") if to_pokemon.held_item is not None: return await ctx.send("That pokémon is already holding an item!") num = await self.bot.mongo.fetch_pokemon_count(ctx.author) await self.bot.mongo.update_pokemon(from_pokemon, {"$set": { f"held_item": None }}) await self.bot.mongo.update_pokemon( to_pokemon, {"$set": { f"held_item": from_pokemon.held_item }}) from_name = str(from_pokemon.species) if from_pokemon.nickname is not None: from_name += f' "{from_pokemon.nickname}"' to_name = str(to_pokemon.species) if to_pokemon.nickname is not None: to_name += f' "{to_pokemon.nickname}"' await ctx.send( f"Moved held item from your level {from_pokemon.level} {from_name} to your level {to_pokemon.level} {to_name}." )
async def moveset(self, ctx, *, search: str): """View all moves for your pokémon and how to get them.""" search = search.strip() if len(search) > 0 and search[0] in "Nn#" and search[1:].isdigit(): species = self.bot.data.species_by_number(int(search[1:])) else: species = self.bot.data.species_by_name(search) if species is None: converter = converters.PokemonConverter(raise_errors=False) pokemon = await converter.convert(ctx, search) if pokemon is not None: species = pokemon.species if species is None: raise commands.BadArgument( "Please either enter the name of a pokémon species, nothing for your selected pokémon, a number for " "a specific pokémon, `latest` for your latest pokémon. ", ) async def get_page(source, menu, pidx): pgstart = pidx * 20 pgend = min(pgstart + 20, len(species.moves)) # Send embed embed = discord.Embed(color=0x9CCFFF) embed.title = f"{species} — Moveset" embed.set_footer( text= f"Showing {pgstart + 1}–{pgend} out of {len(species.moves)}.") for move in species.moves[pgstart:pgend]: embed.add_field(name=move.move.name, value=move.text) for i in range(-pgend % 3): embed.add_field(name="", value="") return embed pages = pagination.ContinuablePages( pagination.FunctionPageSource(math.ceil(len(species.moves) / 20), get_page)) self.bot.menus[ctx.author.id] = pages await pages.start(ctx)
async def select(self, ctx, *, pokemon: converters.PokemonConverter(accept_blank=False)): """Select a specific pokémon from your collection.""" if await self.bot.get_cog("Trading").is_in_trade(ctx.author): return await ctx.send("You can't do that in a trade!") if pokemon is None: return await ctx.send("Couldn't find that pokémon!") num = await self.bot.mongo.fetch_pokemon_count(ctx.author) await self.bot.mongo.update_member( ctx.author, {"$set": {f"selected_id": pokemon.id}}, ) await ctx.send( f"You selected your level {pokemon.level} {pokemon.species}. No. {pokemon.idx}." )