| from pyrogram import filters |
| from pyrogram.types import Message |
| from unidecode import unidecode |
|
|
| from SONALI import app |
| from SONALI.misc import SUDOERS |
| from SONALI.utils.database import ( |
| get_active_chats, |
| get_active_video_chats, |
| remove_active_chat, |
| remove_active_video_chat, |
| ) |
|
|
|
|
| @app.on_message(filters.command(["ac"]) & SUDOERS) |
| async def ac(c, m): |
| audio = len(await get_active_chats()) |
| video = len(await get_active_video_chats()) |
| await m.reply_text(f"ᴀᴜᴅɪᴏ - {audio}\nᴠɪᴅᴇᴏ - {video}") |
| |
| @app.on_message( |
| filters.command( |
| ["activevc", "activevoice"], prefixes=["/", "!", "%", ",", "", ".", "@", "#"] |
| ) |
| & SUDOERS |
| ) |
| async def active_voice_chats(client, message): |
| ic = 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: |
| await remove_active_chat(x) |
| continue |
| try: |
| chat = await app.get_chat(x) |
| if chat.username: |
| user = chat.username |
| text += f"<b>{j + 1}.</b> <a href=https://t.me/{user}>{unidecode(title).upper()}</a> [<code>{x}</code>]\n" |
| else: |
| text += f"<b>{j + 1}.</b> {unidecode(title).upper()} [<code>{x}</code>]\n" |
| j += 1 |
| except: |
| continue |
| if not text: |
| await ic.edit_text(f"» ɴᴏ ᴀᴄᴛɪᴠᴇ ᴠᴏɪᴄᴇ ᴄʜᴀᴛs ᴏɴ {app.mention}.") |
| else: |
| await ic.edit_text( |
| f"<b>» ʟɪsᴛ ᴏғ ᴄᴜʀʀᴇɴᴛʟʏ ᴀᴄᴛɪᴠᴇ ᴠᴏɪᴄᴇ ᴄʜᴀᴛs :</b>\n\n{text}", |
| disable_web_page_preview=True, |
| ) |
| @app.on_message( |
| filters.command( |
| ["activev", "activevideo"], prefixes=["/", "!", "%", ",", "", ".", "@", "#"] |
| ) |
| & 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: |
| await remove_active_video_chat(x) |
| continue |
| try: |
| if (await app.get_chat(x)).username: |
| user = (await app.get_chat(x)).username |
| text += f"<b>{j + 1}.</b> <a href=https://t.me/{user}>{unidecode(title).upper()}</a> [<code>{x}</code>]\n" |
| else: |
| text += ( |
| f"<b>{j + 1}.</b> {unidecode(title).upper()} [<code>{x}</code>]\n" |
| ) |
| j += 1 |
| except: |
| continue |
| if not text: |
| await mystic.edit_text(f"» ɴᴏ ᴀᴄᴛɪᴠᴇ ᴠɪᴅᴇᴏ ᴄʜᴀᴛs ᴏɴ {app.mention}.") |
| else: |
| await mystic.edit_text( |
| f"<b>» ʟɪsᴛ ᴏғ ᴄᴜʀʀᴇɴᴛʟʏ ᴀᴄᴛɪᴠᴇ ᴠɪᴅᴇᴏ ᴄʜᴀᴛs :</b>\n\n{text}", |
| disable_web_page_preview=True, |
| ) |
|
|