Created
June 11, 2022 17:10
-
-
Save hugmouse/374dfea8cc4a46de18bae9cc3f373b81 to your computer and use it in GitHub Desktop.
Re-send last photo to the user/bot
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import asyncio | |
import pyrogram.types | |
from pyrogram import Client | |
from pyrogram.filters import photo | |
api_id = 123 | |
api_hash = "hash" | |
app = Client("my_account", api_id=api_id, api_hash=api_hash) | |
chat_id = 123 # bot id | |
with app: | |
me = app.get_me() | |
@app.on_message(filters=[photo], group=chat_id) | |
async def msg_handler(client: Client, msg: pyrogram.types.Message): | |
if msg.chat.id != chat_id: | |
return | |
if me.id == msg.from_user.id: | |
return | |
await asyncio.sleep(5) | |
await client.send_photo(msg.chat.id, msg.photo.file_id) | |
app.run() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment