Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save x0x8x/e3f73fd1878f8f80e5bb9f50430db580 to your computer and use it in GitHub Desktop.
Save x0x8x/e3f73fd1878f8f80e5bb9f50430db580 to your computer and use it in GitHub Desktop.
autobio autoname autopic for t.me/telethonchat
import asyncio, time, os, shutil
try:
import PIL, pySmartDL
except:
os.system("python3 -m pip install Pillow pySmartDL")
from datetime import datetime
from PIL import Image, ImageDraw, ImageFont
from pySmartDL import SmartDL
from telethon.tl import functions
from telethon.errors import FloodWaitError
from telethon.events import NewMessage, MessageEdited
font_file = "/usr/share/fonts/truetype/dejavu/DejaVuSansMono.ttf"
timeout = 70
me = await client.get_me()
@client.on(events.NewMessage(outgoing=True, pattern="^.autobio"))
@client.on(events.MessageEdited(outgoing=True, pattern="^.autobio"))
async def autobio(event):
if event.fwd_from:
return
while True:
DMY = time.strftime("%d.%m.%Y")
HM = time.strftime("%H:%M")
bio = f"{HM}"
try:
await client(functions.account.UpdateProfileRequest(
about=bio
))
except FloodWaitError as ex:
print(ex)
await asyncio.sleep(ex.seconds)
await asyncio.sleep(timeout)
@client.on(events.NewMessage(outgoing=True, pattern="^.autoname"))
@client.on(events.MessageEdited(outgoing=True, pattern="^.autoname"))
async def autoname(event):
if event.fwd_from:
return
while True:
DM = time.strftime("%d.%m.%y")
HM = time.strftime("%H:%M")
name = f"{me.first_name}{HM}"
try:
await client(functions.account.UpdateProfileRequest(
first_name=name
))
except FloodWaitError as ex:
print(ex)
await asyncio.sleep(ex.seconds)
await asyncio.sleep(timeout)
@client.on(events.NewMessage(outgoing=True, pattern="^.autopic"))
@client.on(events.MessageEdited(outgoing=True, pattern="^.autopic"))
async def autopic(event):
downloaded_file_name = "/tmp/original_pic.png"
downloader = SmartDL(binary, downloaded_file_name, progress_bar=False)
downloader.start(blocking=False)
photo = "/tmp/photo_pfp.png"
while not downloader.isFinished():
place_holder = None
counter = -30
while True:
shutil.copy(downloaded_file_name, photo)
im = Image.open(photo)
file_test = im.rotate(counter, expand=False).save(photo, "PNG")
current_time = datetime.now().strftime("⚡⚡⚡⚡⚡⚡⚡⚡⚡⚡⚡⚡⚡⚡⚡⚡⚡⚡⚡⚡ \n Time: %H:%M \n Date: %d.%m.%y \n⚡⚡⚡⚡⚡⚡⚡⚡⚡⚡⚡⚡⚡⚡⚡⚡⚡⚡⚡⚡")
img = Image.open(photo)
drawn_text = ImageDraw.Draw(img)
fnt = ImageFont.truetype(font_file, 30)
drawn_text.text((95, 250), current_time, font=fnt, fill=(255, 255, 255))
img.save(photo)
file = await bot.upload_file(photo)
try:
await bot(functions.photos.UploadProfilePhotoRequest(
file
))
os.remove(photo)
counter -= 30
await asyncio.sleep(60)
except:
return
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment