catfact.py 文件源码

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

项目:apex-sigma-core 作者: lu-ci 项目源码 文件源码
def catfact(cmd, message, args):
    global facts
    if not facts:
        resource = 'http://www.animalplanet.com/xhr.php'
        resource += '?action=get_facts&limit=500&page_id=37397'
        resource += '&module_id=cfct-module-bdff02c2a38ff3c34ce90ffffce76104&used_slots=W10='
        async with aiohttp.ClientSession() as session:
            async with session.get(resource) as data:
                data = await data.read()
                data = json.loads(data)
                facts = data
    fact = secrets.choice(facts)
    fact_text = fact['description'].strip()
    embed = discord.Embed(color=0xFFDC5D)
    embed.add_field(name='?? Did you know...', value=fact_text)
    await message.channel.send(None, embed=embed)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号