Update marsey_bot.py

master
Guzzy 2023-11-15 09:37:48 +00:00
parent 15993b1693
commit e430e10c40
1 changed files with 3 additions and 3 deletions

View File

@ -33,8 +33,8 @@ def is_animated(file_path): #check if webp is animated or static
except:
return False
def webm2gif(abs_media_path): #convert webp to gif
media = Image.open(abs_media_path) #path of webm file
def webp2gif(abs_media_path): #convert webp to gif
media = Image.open(abs_media_path) #path of webp file
media.info.pop('background', None)
abs_media_path = abs_media_path[:-4]+'gif' #change the path from webp to gif
media.save(abs_media_path, 'gif', optimize=False, save_all=True, disposal=2) #temp save a gif file (there might be a better way but i lazy :marseyteehee:)
@ -69,7 +69,7 @@ async def on_message(message): #bot reads every message in server
#if marsey is animated, turn it into a gif
if is_animated(abs_marsey_path) is True:
abs_marsey_path = webm2gif(abs_marsey_path)
abs_marsey_path = webp2gif(abs_marsey_path)
flag = 1 #flag for deleting temp gif file after sent
#open file and add it to send queue