-
Notifications
You must be signed in to change notification settings - Fork 1
/
active.py
74 lines (69 loc) · 2.57 KB
/
active.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
from pyrogram import filters
from pyrogram.types import Message
from strings import get_command
from AnonX import app
from AnonX.misc import SUDOERS
from AnonX.utils.database.memorydatabase import (
get_active_chats, get_active_video_chats)
from strings.filters import command
# Commands
ACTIVEVC_COMMAND = get_command("ACTIVEVC_COMMAND")
ACTIVEVIDEO_COMMAND = get_command("ACTIVEVIDEO_COMMAND")
@app.on_message(
command(ACTIVEVC_COMMAND)
& SUDOERS
)
async def activevc(_, message: Message):
mystic = await message.reply_text(
"ɢᴇᴛᴛɪɴɢ ᴀᴄᴛɪᴠᴇ ᴠᴏɪᴄᴇᴄʜᴀᴛs ʟɪsᴛ..."
)
served_chats = await get_active_chats()
text = ""
j = 0
for x in served_chats:
try:
title = (await app.get_chat(x)).title
except Exception:
title = "ᴩʀɪᴠᴀᴛᴇ ᴄʜᴀᴛ"
if (await app.get_chat(x)).username:
user = (await app.get_chat(x)).username
text += f"<b>{j + 1}.</b> [{title}](https://t.me/{user})[`{x}`]\n"
else:
text += f"<b>{j + 1}. {title}</b> [`{x}`]\n"
j += 1
if not text:
await mystic.edit_text("ɴᴏ ᴀᴄᴛɪᴠᴇ ᴠᴏɪᴄᴇᴄʜᴀᴛs ᴏɴ ᴍᴜsɪᴄʙᴏᴛ...")
else:
await mystic.edit_text(
f"**ʟɪsᴛ ᴏғ ᴄᴜʀʀᴇɴᴛʟʏ ᴀᴄᴛɪᴠᴇ ᴠᴏɪᴄᴇᴄʜᴀᴛs ᴏɴ ᴍᴜsɪᴄ ʙᴏᴛ :-**\n\n{text}",
disable_web_page_preview=True,
)
@app.on_message(
command(ACTIVEVIDEO_COMMAND)
& SUDOERS
)
async def activevi_(_, message: Message):
mystic = await message.reply_text(
"ɢᴇᴛᴛɪɴɢ ᴀᴄᴛɪᴠᴇ ᴠɪᴅᴇᴏᴄʜᴀᴛs ʟɪsᴛ..."
)
served_chats = await get_active_video_chats()
text = ""
j = 0
for x in served_chats:
try:
title = (await app.get_chat(x)).title
except Exception:
title = "ᴩʀɪᴠᴀᴛᴇ ᴄʜᴀᴛ"
if (await app.get_chat(x)).username:
user = (await app.get_chat(x)).username
text += f"<b>{j + 1}.</b> [{title}](https://t.me/{user})[`{x}`]\n"
else:
text += f"<b>{j + 1}. {title}</b> [`{x}`]\n"
j += 1
if not text:
await mystic.edit_text("ɴᴏ ᴀᴄᴛɪᴠᴇ ᴠɪᴅᴇᴏᴄʜᴀᴛs ᴏɴ ᴍᴜsɪᴄ ʙᴏᴛ...")
else:
await mystic.edit_text(
f"**ʟɪsᴛ ᴏғ ᴄᴜʀʀᴇɴᴛʟʏ ᴀᴄᴛɪᴠᴇ ᴠɪᴅᴇᴏᴄʜᴀᴛs ᴏɴ ᴍᴜsɪᴄ ʙᴏᴛ :-**\n\n{text}",
disable_web_page_preview=True,
)