-
Notifications
You must be signed in to change notification settings - Fork 6
/
bot.py
61 lines (49 loc) · 1.63 KB
/
bot.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
import asyncio
from os import environ
from pyrogram import Client, filters, idle
API_ID = int(environ.get("API_ID"))
API_HASH = environ.get("API_HASH")
BOT_TOKEN = environ.get("BOT_TOKEN")
SESSION = environ.get("SESSION")
TIME = int(environ.get("TIME"))
GROUPS = []
for grp in environ.get("GROUPS").split():
GROUPS.append(int(grp))
ADMINS = []
for usr in environ.get("ADMINS").split():
ADMINS.append(int(usr))
START_MSG = "<b>Hᴇʟʟᴏ {}\n\nI ᴏɴʟʏ sᴜᴘᴘᴏʀᴛ ᴛʜᴇ</b> <a href='http://t.me/Cinimalokham'><b>Cɪɴɪᴍᴀʟᴏᴋʜᴀᴍ</b></a> <b>ɢʀᴏᴜᴘ\n\nI ᴅᴏ ɢʀᴏᴜᴘ ᴀᴜᴛᴏᴍᴀᴛɪᴄ ᴄʟᴇᴀɴɪɴɢ ᴇᴠᴇʀʏ 30 ᴍɪɴᴜᴛᴇs</b>"
User = Client(name="user-account",
session_string=SESSION,
api_id=API_ID,
api_hash=API_HASH,
workers=300
)
Bot = Client(name="auto-delete",
api_id=API_ID,
api_hash=API_HASH,
bot_token=BOT_TOKEN,
workers=300
)
@Bot.on_message(filters.command('start') & filters.private)
async def start(bot, message):
await message.reply(START_MSG.format(message.from_user.mention))
@User.on_message(filters.chat(GROUPS))
async def delete(user, message):
try:
if message.from_user.id in ADMINS:
return
else:
await asyncio.sleep(TIME)
await Bot.delete_messages(message.chat.id, message.id)
except Exception as e:
print(e)
User.start()
print("User Started!")
Bot.start()
print("Bot Started!")
idle()
User.stop()
print("User Stopped!")
Bot.stop()
print("Bot Stopped!")