Import the existing local project snapshot. This commit organizes existing files; it does not represent newly developed functionality.
30 lines
1.0 KiB
Python
30 lines
1.0 KiB
Python
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())
|