mirror of
https://github.com/neoarz/Syntrel.git
synced 2025-12-25 11:40:12 +01:00
refactor(misc): send images directly instead of embed
This commit is contained in:
@@ -1,6 +1,8 @@
|
||||
import discord
|
||||
from discord.ext import commands
|
||||
from discord.ext.commands import Context
|
||||
import aiohttp
|
||||
import io
|
||||
|
||||
|
||||
def depart_command():
|
||||
@@ -10,20 +12,19 @@ def depart_command():
|
||||
)
|
||||
async def depart(self, context):
|
||||
gif_url = "https://yes.nighty.works/raw/Mp6YGV.gif"
|
||||
|
||||
embed = discord.Embed(
|
||||
color=0x7289DA,
|
||||
)
|
||||
embed.set_author(name="Depart", icon_url="https://yes.nighty.works/raw/YxMC0r.png")
|
||||
embed.set_image(url=gif_url)
|
||||
|
||||
|
||||
async with aiohttp.ClientSession() as session:
|
||||
async with session.get(gif_url) as resp:
|
||||
data = await resp.read()
|
||||
file = discord.File(io.BytesIO(data), filename="depart.gif")
|
||||
|
||||
if getattr(context, "interaction", None):
|
||||
inter = context.interaction
|
||||
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:
|
||||
await inter.followup.send(embed=embed, ephemeral=True)
|
||||
await inter.followup.send(file=file, ephemeral=True)
|
||||
else:
|
||||
await context.send(embed=embed)
|
||||
await context.send(file=file)
|
||||
|
||||
return depart
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
import discord
|
||||
from discord.ext import commands
|
||||
from discord.ext.commands import Context
|
||||
import aiohttp
|
||||
import io
|
||||
|
||||
def dontasktoask_command():
|
||||
@commands.hybrid_command(
|
||||
@@ -8,19 +10,20 @@ def dontasktoask_command():
|
||||
description="Shows the 'Don't Ask to Ask' image."
|
||||
)
|
||||
async def dontasktoask(self, context):
|
||||
embed = discord.Embed(
|
||||
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")
|
||||
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):
|
||||
inter = context.interaction
|
||||
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:
|
||||
await inter.followup.send(embed=embed, ephemeral=True)
|
||||
await inter.followup.send(file=file, ephemeral=True)
|
||||
else:
|
||||
await context.send(embed=embed)
|
||||
await context.send(file=file)
|
||||
|
||||
return dontasktoask
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
import discord
|
||||
from discord.ext import commands
|
||||
from discord.ext.commands import Context
|
||||
import aiohttp
|
||||
import io
|
||||
|
||||
|
||||
def piracy_command():
|
||||
@@ -9,20 +11,20 @@ def piracy_command():
|
||||
description="FBI Anti Piracy Warning",
|
||||
)
|
||||
async def piracy(self, context):
|
||||
embed = discord.Embed(
|
||||
color=0xE02B2B,
|
||||
)
|
||||
embed.set_author(name="Piracy", icon_url="https://yes.nighty.works/raw/rVYXlf.png")
|
||||
embed.set_image(url="https://yes.nighty.works/raw/lEhuWK.png")
|
||||
embed.set_footer(text="FBI Anti Piracy Warning", icon_url="https://yes.nighty.works/raw/8qjzP3.png")
|
||||
|
||||
image_url = "https://yes.nighty.works/raw/lEhuWK.png"
|
||||
|
||||
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="piracy.png")
|
||||
|
||||
if getattr(context, "interaction", None):
|
||||
inter = context.interaction
|
||||
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:
|
||||
await inter.followup.send(embed=embed, ephemeral=True)
|
||||
await inter.followup.send(file=file, ephemeral=True)
|
||||
else:
|
||||
await context.send(embed=embed)
|
||||
await context.send(file=file)
|
||||
|
||||
return piracy
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
import discord
|
||||
from discord.ext import commands
|
||||
from discord.ext.commands import Context
|
||||
import aiohttp
|
||||
import io
|
||||
|
||||
|
||||
def rr_command():
|
||||
@@ -10,20 +12,19 @@ def rr_command():
|
||||
)
|
||||
async def rr(self, context):
|
||||
gif_url = "https://yes.nighty.works/raw/JzjMcs.gif"
|
||||
|
||||
embed = discord.Embed(
|
||||
color=0x7289DA,
|
||||
)
|
||||
embed.set_author(name="Rickroll", icon_url="https://yes.nighty.works/raw/YxMC0r.png")
|
||||
embed.set_image(url=gif_url)
|
||||
|
||||
|
||||
async with aiohttp.ClientSession() as session:
|
||||
async with session.get(gif_url) as resp:
|
||||
data = await resp.read()
|
||||
file = discord.File(io.BytesIO(data), filename="rickroll.gif")
|
||||
|
||||
if getattr(context, "interaction", None):
|
||||
inter = context.interaction
|
||||
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:
|
||||
await inter.followup.send(embed=embed, ephemeral=True)
|
||||
await inter.followup.send(file=file, ephemeral=True)
|
||||
else:
|
||||
await context.send(embed=embed)
|
||||
await context.send(file=file)
|
||||
|
||||
return rr
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
import discord
|
||||
from discord.ext import commands
|
||||
from discord.ext.commands import Context
|
||||
import aiohttp
|
||||
import io
|
||||
|
||||
def support_command():
|
||||
@commands.hybrid_command(
|
||||
@@ -8,19 +10,20 @@ def support_command():
|
||||
description="Shows the support image."
|
||||
)
|
||||
async def support(self, context):
|
||||
embed = discord.Embed(
|
||||
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")
|
||||
url = "https://yes.nighty.works/raw/wGzHIV.gif"
|
||||
|
||||
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):
|
||||
inter = context.interaction
|
||||
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:
|
||||
await inter.followup.send(embed=embed, ephemeral=True)
|
||||
await inter.followup.send(file=file, ephemeral=True)
|
||||
else:
|
||||
await context.send(embed=embed)
|
||||
await context.send(file=file)
|
||||
|
||||
return support
|
||||
|
||||
Reference in New Issue
Block a user