-
Notifications
You must be signed in to change notification settings - Fork 5
/
fed_ban.py
231 lines (220 loc) · 7.94 KB
/
fed_ban.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
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
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
# MADE BY LEGENDX22 AND PROBOYX
#CREDITS TELEBOT
# KEEP CREDITS PLEASE 🥺
import asyncio
from LEGENDX import NAME
from ULTRA import CMD_HELP
from ULTRA.utils import admin_cmd
# By (@proboy22), and (@LEGENDX22)
from ULTRA import bot
PRO = NAME
@bot.on(admin_cmd("superfban ?(.*)"))
async def _(event):
if event.fwd_from:
return
await event.edit(f"**STARTING LEGENDS BAN BY {PRO}**...")
fedList = []
if event.reply_to_msg_id:
previous_message = await event.get_reply_message()
if previous_message.media:
downloaded_file_name = await bot.download_media(
previous_message, "fedlist"
)
await asyncio.sleep(6)
file = open(downloaded_file_name, "r")
lines = file.readlines()
for line in lines:
try:
fedList.append(line[:36])
except BaseException:
pass
arg = event.text.split(" ", maxsplit=2)
if len(arg) > 2:
FBAN = arg[1]
REASON = arg[2]
else:
FBAN = arg[1]
REASON = " #LEGENDS FBANNED🔥 "
else:
FBAN = previous_message.sender_id
REASON = event.text.split(" ", maxsplit=1)[1]
if REASON.strip() == "":
REASON = " #LEGENDS FBANNED 🔥"
else:
arg = event.text.split(" ", maxsplit=2)
if len(arg) > 2:
FBAN = arg[1]
REASON = arg[2]
else:
FBAN = arg[1]
REASON = " #LEGENDS FBANNED 🔥 "
try:
int(FBAN)
if int(FBAN) == 1281934570 or int(FBAN) == 1100231654:
await event.edit("BHAAG BETICHOD APNE BAAP KO FBAN DEGA")
return
except BaseException:
if FBAN == "@PROBOYX" or FBAN == "@LEGENDX22":
await event.edit("NIKAL LAWDE TUJHE HI SUPER FBAN KRRAHAHU.")
return
if Config.FBAN_GROUP_ID:
chat = Config.FBAN_GROUP_ID
else:
chat = await event.get_chat()
if not len(fedList):
for a in range(3):
async with bot.conversation("@MissRose_bot") as bot_conv:
await bot_conv.send_message("/start")
await bot_conv.send_message("/myfeds")
await asyncio.sleep(3)
response = await bot_conv.get_response()
await asyncio.sleep(3)
if "make a file" in response.text:
await asyncio.sleep(6)
await response.click(0)
await asyncio.sleep(6)
fedfile = await bot_conv.get_response()
await asyncio.sleep(3)
if fedfile.media:
downloaded_file_name = await bot.download_media(
fedfile, "fedlist"
)
await asyncio.sleep(6)
file = open(downloaded_file_name, "r")
lines = file.readlines()
for line in lines:
try:
fedList.append(line[:36])
except BaseException:
pass
else:
return
if len(fedList) == 0:
await event.edit(f"WAIT MASTER I AM CHECKING {PRO} ALL FEDS GIVE ME TIME ({a+1}/3)...")
else:
break
else:
await event.edit(f"Error")
if "You can only use fed commands once every 5 minutes" in response.text:
await event.edit("Try again after 5 mins.")
return
In = False
tempFedId = ""
for x in response.text:
if x == "`":
if In:
In = False
fedList.append(tempFedId)
tempFedId = ""
else:
In = True
elif In:
tempFedId += x
if len(fedList) == 0:
await event.edit("Something went wrong.")
return
await event.edit(f"FBANNING IN {len(fedList)} BY {PRO} 🔥.")
try:
await bot.send_message(chat, f"/start")
except BaseException:
await event.edit("FBAN_GROUP_ID is incorrect.")
return
await asyncio.sleep(3)
if Config.EXCLUDE_FED:
excludeFed = Config.EXCLUDE_FED.split("|")
for n in range(len(excludeFed)):
excludeFed[n] = excludeFed[n].strip()
exCount = 0
for fed in fedList:
if Config.EXCLUDE_FED and fed in excludeFed:
await bot.send_message(chat, f"{fed} Excluded.")
exCount += 1
continue
await bot.send_message(chat, f"/joinfed {fed}")
await asyncio.sleep(3)
await bot.send_message(chat, f"/fban {FBAN} {REASON}")
await asyncio.sleep(3)
await event.edit(
f"SuperFBan Completed. Affected {len(fedList) - exCount} feds.\n#LEGEND BOT"
)
# By @HeisenbergTheDanger, @its_xditya
# MODIFIED BY PROBOYX
@bot.on(admin_cmd("superunfban ?(.*)"))
async def _(event):
if event.fwd_from:
return
await event.edit(f"**STARTING LEGENDS UNFBANNING BY {PRO}**...")
if event.reply_to_msg_id:
previous_message = await event.get_reply_message()
FBAN = previous_message.sender_id
else:
FBAN = event.pattern_match.group(1)
if Config.FBAN_GROUP_ID:
chat = Config.FBAN_GROUP_ID
else:
chat = await event.get_chat()
fedList = []
for a in range(3):
async with bot.conversation("@MissRose_bot") as bot_conv:
await bot_conv.send_message("/start")
await bot_conv.send_message("/myfeds")
response = await bot_conv.get_response()
if "make a file" in response.text:
await asyncio.sleep(3)
await response.click(0)
fedfile = await bot_conv.get_response()
if fedfile.media:
downloaded_file_name = await bot.download_media(
fedfile, "fedlist"
)
file = open(downloaded_file_name, "r")
lines = file.readlines()
for line in lines:
fedList.append(line[: line.index(":")])
else:
return
if len(fedList) == 0:
await event.edit(f"FINDING {PRO} ALL FEDS GIVE ME SOME TIME({a+1}/3)...")
else:
break
else:
await event.edit(f"Error")
if "You can only use fed commands once every 5 minutes" in response.text:
await event.edit("Try again after 5 mins.")
return
In = False
tempFedId = ""
for x in response.text:
if x == "`":
if In:
In = False
fedList.append(tempFedId)
tempFedId = ""
else:
In = True
elif In:
tempFedId += x
await event.edit(f"UNFBANNING IN {len(fedList)} FEDS BY {PRO}.")
try:
await bot.send_message(chat, f"/start")
except BaseException:
await event.edit("FBAN_GROUP_ID is incorrect.")
return
await asyncio.sleep(5)
for fed in fedList:
await bot.send_message(chat, f"/joinfed {fed}")
await asyncio.sleep(5)
await bot.send_message(chat, f"/unfban {FBAN}")
await asyncio.sleep(5)
await event.edit(f"SuperUnFBan Completed. Affected {len(fedList)} Feds by {PRO}.\n#LEGENDBOT")
# By TEAMLEGEND
# OWNED BY TELEBOT
CMD_HELP.update(
{
"superban": ".superfban <username/userid> <reason>\
\n**Usage**: Mass-Ban in all feds you are admin in.\
\nSet `EXCLUDE_FED fedid1|fedid2` in heroku vars to exclude those feds.\
\nSet var `FBAN_GROUP_ID` to the group with rose, where you want FBan to take place.\
\n\nGet help - @LEGENDX22 OR @PROBOYX."
}
)