pokedex.py 文件源码

python
阅读 23 收藏 0 点赞 0 评论 0

项目:Jumper-Cogs 作者: Redjumpman 项目源码 文件源码
def _item_pokemon(self, *, item_name: str):
        """Search for an item in the Pokémon universe

            Args:
                item_name: variable length string

            Returns:
                Discord embed

            Raises:
                AttributeError: Item not found

            Examples:
                pokemon item master ball
        """
        item = self.search_csv(item_name.title(), 'data/pokedex/Items.csv', data_type='i')
        try:
            color = self.color_lookup(item.category)
        except AttributeError:
            await self.bot.say("An item with that name could not be found.")
        else:
            embed = discord.Embed(colour=color, title=item.name)
            embed.set_thumbnail(url=item.image)
            embed.add_field(name="Cost", value=item.cost)
            embed.add_field(name="Category", value=item.category)
            embed.add_field(name="Effect", value=item.effect)
            await self.bot.say(embed=embed)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号