diff --git a/send_pfp.py b/send_pfp.py new file mode 100644 index 0000000..38a5ebc --- /dev/null +++ b/send_pfp.py @@ -0,0 +1,29 @@ +import asyncio, os +from dotenv import load_dotenv +from pyrogram import Client + +load_dotenv() +app = Client("gdrive_bot", api_id=int(os.getenv("API_ID")), + api_hash=os.getenv("API_HASH"), bot_token=os.getenv("BOT_TOKEN")) + +TARGET = "coaxys" +CAPTION = ( + "Here's your new profile picture. \U0001F5BC\n\n" + "To set it: open @BotFather → /mybots → this bot → " + "Edit Bot → Edit Botpic → send this image." +) + +async def main(): + async with app: + me = await app.get_me() + print("Bot:", me.username) + try: + await app.send_photo(TARGET, "bot_pfp.jpg", caption=CAPTION) + # also send as a file so the original (uncompressed) is available for BotFather + await app.send_document(TARGET, "bot_pfp.jpg", + caption="Original file (use this for the sharpest result).") + print("RESULT: sent to", TARGET) + except Exception as e: + print("RESULT: FAILED ->", type(e).__name__, str(e)) + +asyncio.run(main())