From 7e66ed49174da7a9f052504e038df88ce72134d3 Mon Sep 17 00:00:00 2001 From: bobloy Date: Tue, 23 Jun 2020 12:57:32 -0400 Subject: [PATCH] Handle other file extensions for now --- qrinvite/qrinvite.py | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/qrinvite/qrinvite.py b/qrinvite/qrinvite.py index cef82e1..67d895b 100644 --- a/qrinvite/qrinvite.py +++ b/qrinvite/qrinvite.py @@ -72,9 +72,15 @@ class QRInvite(Cog): file.write(image) if extension == "webp": - new_path = convert_png(str(image_path)) - else: + new_path = convert_webp_to_png(str(image_path)) + elif extension == "gif": + await ctx.send("gif is not supported yet, stay tuned") + return + elif extension == "png": new_path = str(image_path) + else: + await ctx.send(f"{extension} is not supported yet, stay tuned") + return myqr.run( invite, @@ -89,7 +95,7 @@ class QRInvite(Cog): 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.load() alpha = im.split()[-1]