Handle other file extensions for now
This commit is contained in:
parent
a8ebe7eb97
commit
7e66ed4917
@ -72,9 +72,15 @@ class QRInvite(Cog):
|
|||||||
file.write(image)
|
file.write(image)
|
||||||
|
|
||||||
if extension == "webp":
|
if extension == "webp":
|
||||||
new_path = convert_png(str(image_path))
|
new_path = convert_webp_to_png(str(image_path))
|
||||||
else:
|
elif extension == "gif":
|
||||||
|
await ctx.send("gif is not supported yet, stay tuned")
|
||||||
|
return
|
||||||
|
elif extension == "png":
|
||||||
new_path = str(image_path)
|
new_path = str(image_path)
|
||||||
|
else:
|
||||||
|
await ctx.send(f"{extension} is not supported yet, stay tuned")
|
||||||
|
return
|
||||||
|
|
||||||
myqr.run(
|
myqr.run(
|
||||||
invite,
|
invite,
|
||||||
@ -89,7 +95,7 @@ class QRInvite(Cog):
|
|||||||
await ctx.send(file=discord.File(png_fp.read(), "qrcode.png"))
|
await ctx.send(file=discord.File(png_fp.read(), "qrcode.png"))
|
||||||
|
|
||||||
|
|
||||||
def convert_png(path):
|
def convert_webp_to_png(path):
|
||||||
im = Image.open(path)
|
im = Image.open(path)
|
||||||
im.load()
|
im.load()
|
||||||
alpha = im.split()[-1]
|
alpha = im.split()[-1]
|
||||||
|
Loading…
x
Reference in New Issue
Block a user