Пример #1
0
    async def wikihow(self, ctx):
        async with aiohttp.ClientSession() as cs:
            async with cs.get(f"https://api.ksoft.si/images/random-wikihow",
                              headers={"Authorization": f"Bearer {os.environ.get('ksoft_key')}"}) as r:
                res = await r.json()
                embed = discord.Embed(
                    color=self.bot.embed_color,
                    title=f"→ {res['title']}",
                    url=res['article_url']
                )
                embed.set_image(url=res['url'])

                await ctx.send(embed=embed)

                logger.info(f"Meme | Sent Random WikiHow: {ctx.author}")
Пример #2
0
    async def meme(self, ctx):
        async with aiohttp.ClientSession() as cs:
            async with cs.get(f"https://api.ksoft.si/images/random-meme",
                              headers={"Authorization": f"Bearer {os.environ.get('ksoft_key')}"}) as r:
                res = await r.json()
                embed = discord.Embed(
                    color=self.bot.embed_color,
                    title=f"→ {res['title']}",
                    url=res['source']
                )
                embed.set_image(url=res['image_url'])
                embed.set_footer(text=f"👍 {res['upvotes']} | 👎 {res['downvotes']}")

                await ctx.send(embed=embed)

                logger.info(f"Meme | Sent Random Meme: {ctx.author}")