-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathfedstats.py
76 lines (68 loc) · 2.61 KB
/
fedstats.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
import asyncio
# made by telebot
from telethon.errors.rpcerrorlist import YouBlockedUserError
from LEGENDX import NAME
from ULTRA import CMD_HELP
from ULTRA import bot
from ULTRA.utils import admin_cmd
bot = "@MissRose_bot"
LEGENDX = NAME
@borg.on(admin_cmd("fstat ?(.*)"))
async def _(event):
if event.fwd_from:
return
ok = await event.edit(f"**CHECKING BY {LEGENDX}**...")
if event.reply_to_msg_id:
previous_message = await event.get_reply_message()
sysarg = str(previous_message.sender_id)
user = f"[user](tg://user?id={sysarg})"
else:
sysarg = event.pattern_match.group(1)
user = sysarg
if sysarg == "":
await ok.edit(
"`Give me someones id, or reply to somones message to check his/her fedstat.`"
)
return
else:
async with borg.conversation(bot) as conv:
try:
await conv.send_message("/start")
await conv.get_response()
await conv.send_message("/fedstat " + sysarg)
audio = await conv.get_response()
if "Looks like" in audio.text:
await audio.click(0)
await asyncio.sleep(2)
audio = await conv.get_response()
await borg.send_file(
event.chat_id,
audio,
caption=f"List of feds {user} has been banned in.\n\nFSTATS CHECKED BY {LEGENDX} 🔥\n\nCollected by LEGEND BOT.",
)
else:
await borg.send_message(event.chat_id, audio.text)
await event.delete()
except YouBlockedUserError:
await ok.edit("**Error**\n `Unblock` @MissRose_Bot `and try again!")
@borg.on(admin_cmd(pattern="fedinfo ?(.*)"))
async def _(event):
if event.fwd_from:
return
ok = await event.edit("`Extracting information...`")
sysarg = event.pattern_match.group(1)
async with borg.conversation(bot) as conv:
try:
await conv.send_message("/start")
await conv.get_response()
await conv.send_message("/fedinfo " + sysarg)
audio = await conv.get_response()
await ok.edit(audio.text + "\n\nFedInfo Excracted by LEGENDBOT")
except YouBlockedUserError:
await ok.edit("**Error**\n `Unblock` @MissRose_Bot `and try again!")
CMD_HELP.update(
{
"fedstuff": ".fstat <username/userid/reply to user>\nUse - To check the persons fedban stat in @MissRose_Bot.\
\n\n.fedinfo <fedid>\nUse - To see info about the fed."
}
)