Files
Syntrel/cogs/miscellaneous/docs.py

34 lines
1.1 KiB
Python
Raw Permalink Normal View History

2025-10-08 15:29:01 -04:00
import discord
from discord.ext import commands
from discord.ext.commands import Context
import aiohttp
import io
2025-11-02 23:32:52 -05:00
2025-10-08 15:29:01 -04:00
def docs_command():
2025-11-02 23:32:52 -05:00
@commands.hybrid_command(name="docs", description="Shows the docs image.")
2025-10-08 15:29:01 -04:00
async def docs(self, context):
url = "https://yes.nighty.works/raw/akdx0q.webp"
2025-11-02 23:32:52 -05:00
2025-10-08 15:29:01 -04:00
async with aiohttp.ClientSession() as session:
async with session.get(url) as resp:
data = await resp.read()
file = discord.File(io.BytesIO(data), filename="docs.webp")
if getattr(context, "interaction", None):
inter = context.interaction
if not inter.response.is_done():
2025-11-02 23:32:52 -05:00
await inter.response.send_message(
"## Dont be like the rest, read the docs",
file=file,
ephemeral=False,
)
2025-10-08 15:29:01 -04:00
else:
2025-11-02 23:32:52 -05:00
await inter.followup.send(
"## Dont be like the rest, read the docs", file=file, ephemeral=True
)
2025-10-08 15:29:01 -04:00
else:
2025-10-08 20:46:55 -04:00
await context.send("## Dont be like the rest, read the docs", file=file)
2025-11-02 23:32:52 -05:00
2025-10-08 15:29:01 -04:00
return docs