.
# For @UniBorg
# (c) CRYPTONIC U K
"""Auto Profile Updation Commands
.autoname
.autobio"""
import asyncio
import time
from telethon.tl import functions
from telethon.errors import FloodWaitError
from uniborg.util import admin_cmd
DEL_TIME_OUT = 120
@borg.on(admin_cmd("autobio")) # pylint:disable=E0602
async def _(event):
if event.fwd_from:
return
while True:
DMY = time.strftime("%d.%m.%Y")
HM = time.strftime("%H:%M:%S")
bio = f"馃搮 {DMY} | 馃槑Muttahir's Bot馃槑 | 鈱氾笍 {HM}"
logger.info(bio)
try:
await borg(functions.account.UpdateProfileRequest( # pylint:disable=E0602
about=bio
))
except FloodWaitError as ex:
logger.warning(str(e))
await asyncio.sleep(ex.seconds)
# else:
# logger.info(r.stringify())
# await borg.send_message( # pylint:disable=E0602
# Config.PRIVATE_GROUP_BOT_API_ID, # pylint:disable=E0602
# "Successfully Changed Profile Bio"
# )
await asyncio.sleep(DEL_TIME_OUT)
@borg.on(admin_cmd("autoname")) # pylint:disable=E0602
async def _(event):
if event.fwd_from:
return
while True:
DM = time.strftime("%d.%m.%y")
HM = time.strftime("%H:%M")
name = f"鈱歿{HM}|馃槑😎CRYPTONIC😎馃槑|馃搮{DM}"
logger.info(name)
try:
await borg(functions.account.UpdateProfileRequest( # pylint:disable=E0602
first_name=name
))
except FloodWaitError as ex:
logger.warning(str(e))
await asyncio.sleep(ex.seconds)
# else:
# logger.info(r.stringify())
# await borg.send_message( # pylint:disable=E0602
# Config.PRIVATE_GROUP_BOT_API_ID, # pylint:disable=E0602
# "Successfully Changed Profile Name"
# )
await asyncio.sleep(DEL_TIME_OUT)