refactor(misc): send images directly instead of embed

This commit is contained in:
neoarz
2025-10-08 09:49:34 -04:00
parent c099df1a45
commit 087b8095e2
5 changed files with 56 additions and 46 deletions

View File

@@ -1,6 +1,8 @@
import discord import discord
from discord.ext import commands from discord.ext import commands
from discord.ext.commands import Context from discord.ext.commands import Context
import aiohttp
import io
def depart_command(): def depart_command():
@@ -10,20 +12,19 @@ def depart_command():
) )
async def depart(self, context): async def depart(self, context):
gif_url = "https://yes.nighty.works/raw/Mp6YGV.gif" gif_url = "https://yes.nighty.works/raw/Mp6YGV.gif"
embed = discord.Embed( async with aiohttp.ClientSession() as session:
color=0x7289DA, async with session.get(gif_url) as resp:
) data = await resp.read()
embed.set_author(name="Depart", icon_url="https://yes.nighty.works/raw/YxMC0r.png") file = discord.File(io.BytesIO(data), filename="depart.gif")
embed.set_image(url=gif_url)
if getattr(context, "interaction", None): if getattr(context, "interaction", None):
inter = context.interaction inter = context.interaction
if not inter.response.is_done(): if not inter.response.is_done():
await inter.response.send_message(embed=embed, ephemeral=False) await inter.response.send_message(file=file, ephemeral=False)
else: else:
await inter.followup.send(embed=embed, ephemeral=True) await inter.followup.send(file=file, ephemeral=True)
else: else:
await context.send(embed=embed) await context.send(file=file)
return depart return depart

View File

@@ -1,6 +1,8 @@
import discord import discord
from discord.ext import commands from discord.ext import commands
from discord.ext.commands import Context from discord.ext.commands import Context
import aiohttp
import io
def dontasktoask_command(): def dontasktoask_command():
@commands.hybrid_command( @commands.hybrid_command(
@@ -8,19 +10,20 @@ def dontasktoask_command():
description="Shows the 'Don't Ask to Ask' image." description="Shows the 'Don't Ask to Ask' image."
) )
async def dontasktoask(self, context): async def dontasktoask(self, context):
embed = discord.Embed( image_url = "https://yes.nighty.works/raw/KecbCr.jpg"
color=0x7289DA
)
embed.set_author(name="Don't Ask to Ask", icon_url="https://yes.nighty.works/raw/YxMC0r.png")
embed.set_image(url="https://yes.nighty.works/raw/KecbCr.jpg")
async with aiohttp.ClientSession() as session:
async with session.get(image_url) as resp:
data = await resp.read()
file = discord.File(io.BytesIO(data), filename="dontasktoask.jpg")
if getattr(context, "interaction", None): if getattr(context, "interaction", None):
inter = context.interaction inter = context.interaction
if not inter.response.is_done(): if not inter.response.is_done():
await inter.response.send_message(embed=embed, ephemeral=False) await inter.response.send_message(file=file, ephemeral=False)
else: else:
await inter.followup.send(embed=embed, ephemeral=True) await inter.followup.send(file=file, ephemeral=True)
else: else:
await context.send(embed=embed) await context.send(file=file)
return dontasktoask return dontasktoask

View File

@@ -1,6 +1,8 @@
import discord import discord
from discord.ext import commands from discord.ext import commands
from discord.ext.commands import Context from discord.ext.commands import Context
import aiohttp
import io
def piracy_command(): def piracy_command():
@@ -9,20 +11,20 @@ def piracy_command():
description="FBI Anti Piracy Warning", description="FBI Anti Piracy Warning",
) )
async def piracy(self, context): async def piracy(self, context):
embed = discord.Embed( image_url = "https://yes.nighty.works/raw/lEhuWK.png"
color=0xE02B2B,
) async with aiohttp.ClientSession() as session:
embed.set_author(name="Piracy", icon_url="https://yes.nighty.works/raw/rVYXlf.png") async with session.get(image_url) as resp:
embed.set_image(url="https://yes.nighty.works/raw/lEhuWK.png") data = await resp.read()
embed.set_footer(text="FBI Anti Piracy Warning", icon_url="https://yes.nighty.works/raw/8qjzP3.png") file = discord.File(io.BytesIO(data), filename="piracy.png")
if getattr(context, "interaction", None): if getattr(context, "interaction", None):
inter = context.interaction inter = context.interaction
if not inter.response.is_done(): if not inter.response.is_done():
await inter.response.send_message(embed=embed, ephemeral=False) await inter.response.send_message(file=file, ephemeral=False)
else: else:
await inter.followup.send(embed=embed, ephemeral=True) await inter.followup.send(file=file, ephemeral=True)
else: else:
await context.send(embed=embed) await context.send(file=file)
return piracy return piracy

View File

@@ -1,6 +1,8 @@
import discord import discord
from discord.ext import commands from discord.ext import commands
from discord.ext.commands import Context from discord.ext.commands import Context
import aiohttp
import io
def rr_command(): def rr_command():
@@ -10,20 +12,19 @@ def rr_command():
) )
async def rr(self, context): async def rr(self, context):
gif_url = "https://yes.nighty.works/raw/JzjMcs.gif" gif_url = "https://yes.nighty.works/raw/JzjMcs.gif"
embed = discord.Embed( async with aiohttp.ClientSession() as session:
color=0x7289DA, async with session.get(gif_url) as resp:
) data = await resp.read()
embed.set_author(name="Rickroll", icon_url="https://yes.nighty.works/raw/YxMC0r.png") file = discord.File(io.BytesIO(data), filename="rickroll.gif")
embed.set_image(url=gif_url)
if getattr(context, "interaction", None): if getattr(context, "interaction", None):
inter = context.interaction inter = context.interaction
if not inter.response.is_done(): if not inter.response.is_done():
await inter.response.send_message(embed=embed, ephemeral=False) await inter.response.send_message(file=file, ephemeral=False)
else: else:
await inter.followup.send(embed=embed, ephemeral=True) await inter.followup.send(file=file, ephemeral=True)
else: else:
await context.send(embed=embed) await context.send(file=file)
return rr return rr

View File

@@ -1,6 +1,8 @@
import discord import discord
from discord.ext import commands from discord.ext import commands
from discord.ext.commands import Context from discord.ext.commands import Context
import aiohttp
import io
def support_command(): def support_command():
@commands.hybrid_command( @commands.hybrid_command(
@@ -8,19 +10,20 @@ def support_command():
description="Shows the support image." description="Shows the support image."
) )
async def support(self, context): async def support(self, context):
embed = discord.Embed( url = "https://yes.nighty.works/raw/wGzHIV.gif"
color=0x7289DA
)
embed.set_author(name="Support", icon_url="https://yes.nighty.works/raw/YxMC0r.png")
embed.set_image(url="https://yes.nighty.works/raw/X8XeCV.png")
async with aiohttp.ClientSession() as session:
async with session.get(url) as resp:
data = await resp.read()
file = discord.File(io.BytesIO(data), filename="support.gif")
if getattr(context, "interaction", None): if getattr(context, "interaction", None):
inter = context.interaction inter = context.interaction
if not inter.response.is_done(): if not inter.response.is_done():
await inter.response.send_message(embed=embed, ephemeral=False) await inter.response.send_message(file=file, ephemeral=False)
else: else:
await inter.followup.send(embed=embed, ephemeral=True) await inter.followup.send(file=file, ephemeral=True)
else: else:
await context.send(embed=embed) await context.send(file=file)
return support return support