Skip to content

Commit

Permalink
Update pixelateTG.py
Browse files Browse the repository at this point in the history
  • Loading branch information
arbadacarbaYK authored May 30, 2024
1 parent 38bbb6a commit 7e47fc9
Showing 1 changed file with 13 additions and 10 deletions.
23 changes: 13 additions & 10 deletions pixelateTG.py
Original file line number Diff line number Diff line change
Expand Up @@ -134,20 +134,23 @@ def pixelate_faces(update: Update, context: CallbackContext) -> None:
update.message.reply_text('Press buttons until happy', reply_markup=reply_markup)
update.message.delete()

elif update.message.document and update.message.document.mime_type == 'image/gif':
file_id = update.message.document.file_id
file = context.bot.get_file(file_id)
file_name = file.file_path.split('/')[-1]
gif_path = f"downloads/{file_name}"
file.download(gif_path)

processed_gif_path = process_gif(gif_path, session_id, str(uuid4()), context.bot)
context.bot.send_animation(chat_id=update.message.from_user.id, animation=open(processed_gif_path, 'rb'))

elif update.message.document:
if update.message.document.mime_type == 'image/gif':
file_id = update.message.document.file_id
file = context.bot.get_file(file_id)
file_name = file.file_path.split('/')[-1]
gif_path = f"downloads/{file_name}"
file.download(gif_path)

processed_gif_path = process_gif(gif_path, session_id, str(uuid4()), context.bot)
context.bot.send_animation(chat_id=update.message.from_user.id, animation=open(processed_gif_path, 'rb'))
else:
update.message.reply_text('Please send either a photo or a GIF.')
else:
update.message.reply_text('Please send either a photo or a GIF.')



def pixelate_command(update: Update, context: CallbackContext) -> None:
if update.message.reply_to_message and update.message.reply_to_message.photo:
session_id = str(uuid4())
Expand Down

0 comments on commit 7e47fc9

Please sign in to comment.