moving canvass tools into their own cog
This commit is contained in:
parent
636fd8a4bf
commit
88b0f338ac
80
app/cogs/canvas_tools.py
Normal file
80
app/cogs/canvas_tools.py
Normal file
@ -0,0 +1,80 @@
|
||||
from discord.ext import commands
|
||||
import core_utils
|
||||
import discord
|
||||
import random
|
||||
import requests
|
||||
import os
|
||||
|
||||
|
||||
class Canvass(commands.Cog):
|
||||
def __init__(self, bot):
|
||||
self.bot: commands.Bot = bot
|
||||
|
||||
@commands.command(name="simp")
|
||||
async def simp(self, ctx: commands.Context, image_link=None):
|
||||
if not image_link:
|
||||
return await ctx.send("You must provide a link to an image")
|
||||
response = requests.get(
|
||||
"https://some-random-api.ml/canvas/simpcard/?avatar=%s" % image_link
|
||||
)
|
||||
with open("/app/simp.jpg", "wb") as f:
|
||||
f.write(response.content)
|
||||
await ctx.message.delete()
|
||||
await ctx.send(file=discord.File("/app/simp.jpg"))
|
||||
os.remove("/app/simp.jpg")
|
||||
|
||||
@commands.command(name="horny")
|
||||
async def horny(self, ctx: commands.Context, image_link=None):
|
||||
if not image_link:
|
||||
return await ctx.send("You must provide a link to an image")
|
||||
response = requests.get(
|
||||
"https://some-random-api.ml/canvas/horny/?avatar=%s" % image_link
|
||||
)
|
||||
with open("/app/horny.jpg", "wb") as f:
|
||||
f.write(response.content)
|
||||
await ctx.message.delete()
|
||||
await ctx.send(file=discord.File("/app/horny.jpg"))
|
||||
os.remove("/app/horny.jpg")
|
||||
|
||||
@commands.command(name="wasted")
|
||||
async def wasted(self, ctx: commands.Context, image_link=None):
|
||||
if not image_link:
|
||||
return await ctx.send("You must provide a link to an image")
|
||||
response = requests.get(
|
||||
"https://some-random-api.ml/canvas/wasted/?avatar=%s" % image_link
|
||||
)
|
||||
with open("/app/wasted.jpg", "wb") as f:
|
||||
f.write(response.content)
|
||||
await ctx.message.delete()
|
||||
await ctx.send(file=discord.File("/app/wasted.jpg"))
|
||||
os.remove("/app/wasted.jpg")
|
||||
|
||||
@commands.command(name="pixelate")
|
||||
async def pixelate(self, ctx: commands.Context, image_link=None):
|
||||
if not image_link:
|
||||
return await ctx.send("You must provide a link to an image")
|
||||
response = requests.get(
|
||||
"https://some-random-api.ml/canvas/pixelate/?avatar=%s" % image_link
|
||||
)
|
||||
with open("/app/pixelate.jpg", "wb") as f:
|
||||
f.write(response.content)
|
||||
await ctx.message.delete()
|
||||
await ctx.send(file=discord.File("/app/pixelate.jpg"))
|
||||
os.remove("/app/pixelate.jpg")
|
||||
|
||||
@commands.command(name="blur")
|
||||
async def blur(self, ctx: commands.Context, image_link=None):
|
||||
if not image_link:
|
||||
return await ctx.send("You must provide a link to an image")
|
||||
response = requests.get(
|
||||
"https://some-random-api.ml/canvas/blur/?avatar=%s" % image_link
|
||||
)
|
||||
with open("/app/blur.jpg", "wb") as f:
|
||||
f.write(response.content)
|
||||
await ctx.message.delete()
|
||||
await ctx.send(file=discord.File("/app/blur.jpg"))
|
||||
os.remove("/app/blur.jpg")
|
||||
|
||||
|
||||
def setup(bot):
|
||||
bot.add_cog(Canvass(bot))
|
@ -16,45 +16,6 @@ class Cheeky(commands.Cog):
|
||||
|
||||
await ctx.reply(decide.decide(ctx.message.content))
|
||||
|
||||
@commands.command(name="simp")
|
||||
async def simp(self, ctx: commands.Context):
|
||||
if len(ctx.message.content.split()) == 1:
|
||||
return await ctx.send("You must provide a link to an image")
|
||||
response = requests.get(
|
||||
"https://some-random-api.ml/canvas/simpcard/?avatar=%s"
|
||||
% ctx.message.content.split()[-1]
|
||||
)
|
||||
with open("/app/simp.jpg", "wb") as f:
|
||||
f.write(response.content)
|
||||
await ctx.message.delete()
|
||||
await ctx.send(file=discord.File("/app/simp.jpg"))
|
||||
|
||||
@commands.command(name="horny")
|
||||
async def horny(self, ctx: commands.Context):
|
||||
if len(ctx.message.content.split()) == 1:
|
||||
return await ctx.send("You must provide a link to an image")
|
||||
response = requests.get(
|
||||
"https://some-random-api.ml/canvas/horny/?avatar=%s"
|
||||
% ctx.message.content.split()[-1]
|
||||
)
|
||||
with open("/app/horny.jpg", "wb") as f:
|
||||
f.write(response.content)
|
||||
await ctx.message.delete()
|
||||
await ctx.send(file=discord.File("/app/horny.jpg"))
|
||||
|
||||
@commands.command(name="wasted")
|
||||
async def wasted(self, ctx: commands.Context):
|
||||
if len(ctx.message.content.split()) == 1:
|
||||
return await ctx.send("You must provide a link to an image")
|
||||
response = requests.get(
|
||||
"https://some-random-api.ml/canvas/wasted/?avatar=%s"
|
||||
% ctx.message.content.split()[-1]
|
||||
)
|
||||
with open("/app/wasted.jpg", "wb") as f:
|
||||
f.write(response.content)
|
||||
await ctx.message.delete()
|
||||
await ctx.send(file=discord.File("/app/wasted.jpg"))
|
||||
|
||||
@commands.command(name="verify")
|
||||
async def verify(self, ctx: commands.Context):
|
||||
message = list(await ctx.message.channel.history(limit=2).flatten())[-1]
|
||||
|
@ -1 +1 @@
|
||||
docker run --rm -ti -v $(pwd):/tmp/python/app python:alpine sh -c "cd /tmp/python ; pip install black; black ."
|
||||
docker run --rm -ti -v $(pwd):/tmp/python/app python:alpine sh -c "cd /tmp/python ; pip install -q black; black ."
|
||||
|
Loading…
x
Reference in New Issue
Block a user