new command
for generating list of all active group call in bot database
This commit is contained in:
parent
af4020bafb
commit
bf7f83f324
@ -6,7 +6,6 @@ from pyrogram.types import Message
|
||||
from pyrogram import Client, filters, __version__ as pyrover
|
||||
|
||||
from pytgcalls import (__version__ as pytgver)
|
||||
|
||||
from program import __version__ as ver
|
||||
from program.start import __python_version__ as pyver
|
||||
|
||||
@ -15,6 +14,7 @@ from driver.decorators import bot_creator, sudo_users_only
|
||||
from driver.database.dbchat import get_served_chats
|
||||
from driver.database.dbusers import get_served_users
|
||||
from driver.database.dbpunish import get_gbans_count
|
||||
from driver.database.dbqueue import get_active_chats
|
||||
|
||||
from config import BOT_NAME as name, BOT_USERNAME as uname
|
||||
|
||||
@ -123,7 +123,7 @@ async def broadcast_message_pin(c: Client, message: Message):
|
||||
|
||||
@Client.on_message(command(["stats", f"stats@{uname}"]) & ~filters.edited)
|
||||
@sudo_users_only
|
||||
async def broadcast(c: Client, message: Message):
|
||||
async def bot_statistic(c: Client, message: Message):
|
||||
chat_id = message.chat.id
|
||||
user_id = message.from_user.id
|
||||
msg = await c.send_message(
|
||||
@ -146,3 +146,37 @@ async def broadcast(c: Client, message: Message):
|
||||
🤖 bot version: `{ver}`"""
|
||||
|
||||
await msg.edit(tgm, disable_web_page_preview=True)
|
||||
|
||||
|
||||
@Client.on_message(command(["calls", f"calls@{uname}"]) & ~filters.edited)
|
||||
@sudo_users_only
|
||||
async def active_calls(c: Client, message: Message):
|
||||
served_chats = []
|
||||
try:
|
||||
chats = await get_active_chats()
|
||||
for chat in chats:
|
||||
served_chats.append(int(chat["chat_id"]))
|
||||
except Exception as e:
|
||||
await message.reply_text(f"🚫 error: `{e}`")
|
||||
text = ""
|
||||
j = 0
|
||||
for x in served_chats:
|
||||
try:
|
||||
title = (await c.get_chat(x)).title
|
||||
except Exception:
|
||||
title = "Private Group"
|
||||
if (await c.get_chat(x)).username:
|
||||
user = (await c.get_chat(x)).username
|
||||
text += (
|
||||
f"**{j + 1}.** [{title}](https://t.me/{user}) [`{x}`]\n"
|
||||
)
|
||||
else:
|
||||
text += f"**{j + 1}.** {title} [`{x}`]\n"
|
||||
j += 1
|
||||
if not text:
|
||||
await message.reply_text("❌ no active group calls")
|
||||
else:
|
||||
await message.reply_text(
|
||||
f"✏️ **Active video chats list:**\n\n{text}",
|
||||
disable_web_page_preview=True,
|
||||
)
|
||||
|
Loading…
Reference in New Issue
Block a user