initial commit
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
commit
c22dade3d5
21 files changed
+564
No files matched your search
+11
@@ -0,0 +1,11 @@
|
||||
import io,time
|
||||
import aiohttp,discord
|
||||
from discord.ext import commands
|
||||
class cat(commands.Cog):
|
||||
def __init__(s,bot):s.bot=bot
|
||||
@commands.command()
|
||||
async def cat(s,ctx):
|
||||
async with aiohttp.ClientSession(timeout=aiohttp.ClientTimeout(total=15)) as http,http.get("https://cataas.com/cat") as r:
|
||||
r.raise_for_status();data=await r.read();ext=r.content_type.split('/')[-1].replace('jpeg','jpg')
|
||||
await ctx.send(file=discord.File(io.BytesIO(data),filename=f"cat-{int(time.time())}.{ext}"))
|
||||
async def setup(bot):await bot.add_cog(cat(bot))
|
||||
Reference in new issue
Block a user