-
Notifications
You must be signed in to change notification settings - Fork 1
/
auto_profile.py
93 lines (82 loc) · 3.06 KB
/
auto_profile.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
import asyncio
import time
from telethon.errors import FloodWaitError
from telethon.tl import functions
from telethon.tl.functions.channels import GetAdminedPublicChannelsRequest
from . import *
DEFAULTUSERBIO = Config.BIO_MSG
DEL_TIME_OUT = 60
@bot.on(d3vil_cmd(pattern="autoname"))
async def _(event):
if event.fwd_from:
return
d3vil = await edit_or_reply(event, "`Starting AutoName Please Wait`")
if event.fwd_from:
return
while True:
HB = time.strftime("%d-%m-%y")
HE = time.strftime("%H:%M")
name = f"🕒{HE} ⚡{D3VIL_USER}⚡ 📅{HB}"
logger.info(name)
try:
await bot(
functions.account.UpdateProfileRequest( # pylint:disable=E0602
first_name=name
)
)
except FloodWaitError as ex:
logger.warning(str(e))
await asyncio.sleep(ex.seconds)
await asyncio.sleep(DEL_TIME_OUT)
await d3vil.edit(f"Auto Name has been started my Master")
await bot.send_message(Config.LOGGER_ID, "#AUTONAME \n\nAutoname Started!!")
@bot.on(d3vil_cmd(pattern="autobio")) # pylint:disable=E0602
async def _(event):
if event.fwd_from:
return
await event.edit("Starting AutoBio...")
while True:
DMY = time.strftime("%d.%m.%Y")
HM = time.strftime("%H:%M:%S")
bio = f"📅 {DMY} | {DEFAULTUSERBIO} | ⌚️ {HM}"
logger.info(bio)
try:
await bot(
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 bot.send_message( # pylint:disable=E0602
# Config.PRIVATE_GROUP_BOT_API_ID, # pylint:disable=E0602
# "Successfully Changed Profile Bio"
# )
await asyncio.sleep(DEL_TIME_OUT)
await event.edit("AutoBio Activated...")
await bot.send_message(Config.LOGGER_ID, "#AUTOBIO \n\nAutoBio Started!!")
@bot.on(d3vil_cmd(pattern="reserved", outgoing=True))
@bot.on(sudo_cmd(pattern="reserved", allow_sudo=True))
async def mine(event):
if event.fwd_from:
return
""" For .reserved command, get a list of your reserved usernames. """
result = await bot(GetAdminedPublicChannelsRequest())
output_str = ""
for channel_obj in result.chats:
output_str += f"{channel_obj.title}\n@{channel_obj.username}\n\n"
await edit_or_reply(event, output_str)
CmdHelp("auto_profile").add_command(
'autobio', None, 'Changes your bio with time. Need to set BIO_MSG in heroku vars(optional)'
).add_command(
'autoname', None, 'Changes your name with time according to your ALIVE_NAME in heroku var'
).add_command(
'reserved', None, 'Gives the list of usernames reserved by you. In short gives the list of public groups or channels that you are owner in.'
).add_info(
"Manage Profiles"
).add_warning(
"🚫 Potentially Harmful"
).add()