make all the canvass tools slash commands
This commit is contained in:
parent
ce1135976e
commit
a12a67985e
@ -1,4 +1,5 @@
|
|||||||
from discord.ext import commands
|
from discord.ext import commands
|
||||||
|
from discord import option
|
||||||
import core_utils
|
import core_utils
|
||||||
import discord
|
import discord
|
||||||
import random
|
import random
|
||||||
@ -10,69 +11,117 @@ class Canvass(commands.Cog):
|
|||||||
def __init__(self, bot):
|
def __init__(self, bot):
|
||||||
self.bot: commands.Bot = bot
|
self.bot: commands.Bot = bot
|
||||||
|
|
||||||
@commands.command(name="simp")
|
@commands.slash_command(
|
||||||
async def simp(self, ctx: commands.Context, image_link=None):
|
guild_ids=None,
|
||||||
if not image_link:
|
name="simp",
|
||||||
|
description="Takes a URL and returns it embded in a simp card",
|
||||||
|
)
|
||||||
|
@option(
|
||||||
|
"url",
|
||||||
|
description="A URL of the image you want to use",
|
||||||
|
input_type="str",
|
||||||
|
required=True,
|
||||||
|
)
|
||||||
|
async def simp(self, ctx: commands.Context, url: str):
|
||||||
|
if not url:
|
||||||
return await ctx.send("You must provide a link to an image")
|
return await ctx.send("You must provide a link to an image")
|
||||||
response = requests.get(
|
response = requests.get(
|
||||||
"https://some-random-api.ml/canvas/simpcard/?avatar=%s" % image_link
|
"https://some-random-api.ml/canvas/simpcard/?avatar=%s" % url
|
||||||
)
|
)
|
||||||
with open("/app/simp.jpg", "wb") as f:
|
with open("/app/simp.jpg", "wb") as f:
|
||||||
f.write(response.content)
|
f.write(response.content)
|
||||||
await ctx.message.delete()
|
await ctx.defer()
|
||||||
await ctx.send(file=discord.File("/app/simp.jpg"))
|
await ctx.send_followup(file=discord.File("/app/simp.jpg"))
|
||||||
os.remove("/app/simp.jpg")
|
os.remove("/app/simp.jpg")
|
||||||
|
|
||||||
@commands.command(name="horny")
|
@commands.slash_command(
|
||||||
async def horny(self, ctx: commands.Context, image_link=None):
|
guild_ids=None,
|
||||||
if not image_link:
|
name="horny",
|
||||||
|
description="Takes a URL and returns it embded in a license to be horny",
|
||||||
|
)
|
||||||
|
@option(
|
||||||
|
"url",
|
||||||
|
description="A URL of the image you want to use",
|
||||||
|
input_type="str",
|
||||||
|
required=True,
|
||||||
|
)
|
||||||
|
async def horny(self, ctx: commands.Context, url: str):
|
||||||
|
if not url:
|
||||||
return await ctx.send("You must provide a link to an image")
|
return await ctx.send("You must provide a link to an image")
|
||||||
response = requests.get(
|
response = requests.get(
|
||||||
"https://some-random-api.ml/canvas/horny/?avatar=%s" % image_link
|
"https://some-random-api.ml/canvas/horny/?avatar=%s" % url
|
||||||
)
|
)
|
||||||
with open("/app/horny.jpg", "wb") as f:
|
with open("/app/horny.jpg", "wb") as f:
|
||||||
f.write(response.content)
|
f.write(response.content)
|
||||||
await ctx.message.delete()
|
await ctx.defer()
|
||||||
await ctx.send(file=discord.File("/app/horny.jpg"))
|
await ctx.send_followup(file=discord.File("/app/horny.jpg"))
|
||||||
os.remove("/app/horny.jpg")
|
os.remove("/app/horny.jpg")
|
||||||
|
|
||||||
@commands.command(name="wasted")
|
@commands.slash_command(
|
||||||
async def wasted(self, ctx: commands.Context, image_link=None):
|
guild_ids=None,
|
||||||
if not image_link:
|
name="wasted",
|
||||||
|
description="Takes a URL and returns it black and white with wasted text over it",
|
||||||
|
)
|
||||||
|
@option(
|
||||||
|
"url",
|
||||||
|
description="A URL of the image you want to use",
|
||||||
|
input_type="str",
|
||||||
|
required=True,
|
||||||
|
)
|
||||||
|
async def wasted(self, ctx: commands.Context, url: str):
|
||||||
|
if not url:
|
||||||
return await ctx.send("You must provide a link to an image")
|
return await ctx.send("You must provide a link to an image")
|
||||||
response = requests.get(
|
response = requests.get(
|
||||||
"https://some-random-api.ml/canvas/wasted/?avatar=%s" % image_link
|
"https://some-random-api.ml/canvas/wasted/?avatar=%s" % url
|
||||||
)
|
)
|
||||||
with open("/app/wasted.jpg", "wb") as f:
|
with open("/app/wasted.jpg", "wb") as f:
|
||||||
f.write(response.content)
|
f.write(response.content)
|
||||||
await ctx.message.delete()
|
await ctx.defer()
|
||||||
await ctx.send(file=discord.File("/app/wasted.jpg"))
|
await ctx.send_followup(file=discord.File("/app/wasted.jpg"))
|
||||||
os.remove("/app/wasted.jpg")
|
os.remove("/app/wasted.jpg")
|
||||||
|
|
||||||
@commands.command(name="pixelate")
|
@commands.slash_command(
|
||||||
async def pixelate(self, ctx: commands.Context, image_link=None):
|
guild_ids=None,
|
||||||
if not image_link:
|
name="pixelate",
|
||||||
|
description="Takes a URL and returns it pixelated",
|
||||||
|
)
|
||||||
|
@option(
|
||||||
|
"url",
|
||||||
|
description="A URL of the image you want to use",
|
||||||
|
input_type="str",
|
||||||
|
required=True,
|
||||||
|
)
|
||||||
|
async def pixelate(self, ctx: commands.Context, url: str):
|
||||||
|
if not url:
|
||||||
return await ctx.send("You must provide a link to an image")
|
return await ctx.send("You must provide a link to an image")
|
||||||
response = requests.get(
|
response = requests.get(
|
||||||
"https://some-random-api.ml/canvas/pixelate/?avatar=%s" % image_link
|
"https://some-random-api.ml/canvas/pixelate/?avatar=%s" % url
|
||||||
)
|
)
|
||||||
with open("/app/pixelate.jpg", "wb") as f:
|
with open("/app/pixelate.jpg", "wb") as f:
|
||||||
f.write(response.content)
|
f.write(response.content)
|
||||||
await ctx.message.delete()
|
await ctx.defer()
|
||||||
await ctx.send(file=discord.File("/app/pixelate.jpg"))
|
await ctx.send_followup(file=discord.File("/app/pixelate.jpg"))
|
||||||
os.remove("/app/pixelate.jpg")
|
os.remove("/app/pixelate.jpg")
|
||||||
|
|
||||||
@commands.command(name="blur")
|
@commands.slash_command(
|
||||||
async def blur(self, ctx: commands.Context, image_link=None):
|
guild_ids=None, name="blur", description="Takes a URL and returns it blurry"
|
||||||
if not image_link:
|
)
|
||||||
|
@option(
|
||||||
|
"url",
|
||||||
|
description="A URL of the image you want to use",
|
||||||
|
input_type="str",
|
||||||
|
required=True,
|
||||||
|
)
|
||||||
|
async def blur(self, ctx: commands.Context, url: str):
|
||||||
|
if not url:
|
||||||
return await ctx.send("You must provide a link to an image")
|
return await ctx.send("You must provide a link to an image")
|
||||||
response = requests.get(
|
response = requests.get(
|
||||||
"https://some-random-api.ml/canvas/blur/?avatar=%s" % image_link
|
"https://some-random-api.ml/canvas/blur/?avatar=%s" % url
|
||||||
)
|
)
|
||||||
with open("/app/blur.jpg", "wb") as f:
|
with open("/app/blur.jpg", "wb") as f:
|
||||||
f.write(response.content)
|
f.write(response.content)
|
||||||
await ctx.message.delete()
|
await ctx.defer()
|
||||||
await ctx.send(file=discord.File("/app/blur.jpg"))
|
await ctx.send_followup(file=discord.File("/app/blur.jpg"))
|
||||||
os.remove("/app/blur.jpg")
|
os.remove("/app/blur.jpg")
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user