Fixed exception on sticker length limit + added logging to admin

This commit is contained in:
Ed 2023-08-18 10:53:54 +02:00
parent 3d195e8e16
commit a3eca6e7d1
1 changed files with 4 additions and 1 deletions

5
bot.py
View File

@ -77,7 +77,8 @@ async def handler(ev):
# Limit stickers ratio (so people don't print incredibly long stickers) # Limit stickers ratio (so people don't print incredibly long stickers)
if img.size[1]/img.size[0] > MAX_ASPECT_RATIO: if img.size[1]/img.size[0] > MAX_ASPECT_RATIO:
return ev.respond(RATIO_ERR_MSG) await ev.respond(RATIO_ERR_MSG)
return
# Remove transparency # Remove transparency
if img.mode == 'RGBA': if img.mode == 'RGBA':
@ -95,6 +96,8 @@ async def handler(ev):
img.save(IMAGE_PATH, 'PNG') img.save(IMAGE_PATH, 'PNG')
await client.forward_messages(ADMIN_ID, ev.message)
status_code = system(PRINT_COMMAND) status_code = system(PRINT_COMMAND)
if status_code == 0: if status_code == 0:
print_log[ev.peer_id.user_id] = time() print_log[ev.peer_id.user_id] = time()