Skip to content

Commit

Permalink
Command Added for Checking Active Video Calls on Bot.
Browse files Browse the repository at this point in the history
  • Loading branch information
NotReallyShikhar committed Jan 8, 2022
1 parent d08475c commit c689be0
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 4 deletions.
2 changes: 2 additions & 0 deletions Yukki/Plugins/Admins.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,8 @@
/activevc
- Check active voice chats on bot.
/activevideo
- Check active video calls on bot.
"""


Expand Down
5 changes: 3 additions & 2 deletions Yukki/Plugins/Callback.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,9 @@
from Yukki.Core.PyTgCalls.Yukki import (join_stream, pause_stream,
resume_stream, skip_stream,
skip_video_stream, stop_stream)
from Yukki.Database import (_get_playlists, delete_playlist, get_playlist, remove_active_video_chat,
get_playlist_names, is_active_chat, save_playlist)
from Yukki.Database import (_get_playlists, delete_playlist, get_playlist,
get_playlist_names, is_active_chat,
remove_active_video_chat, save_playlist)
from Yukki.Database.queue import (add_active_chat, is_active_chat,
is_music_playing, music_off, music_on,
remove_active_chat)
Expand Down
37 changes: 35 additions & 2 deletions Yukki/Plugins/Voicechat.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@

from config import get_queue
from Yukki import SUDOERS, app, db_mem, random_assistant
from Yukki.Database import (get_active_chats, get_assistant, is_active_chat,
save_assistant)
from Yukki.Database import (get_active_chats, get_active_video_chats,
get_assistant, is_active_chat, save_assistant)
from Yukki.Decorators.checker import checker, checkerCB
from Yukki.Inline import primary_markup
from Yukki.Utilities.assistant import get_assistant_details
Expand Down Expand Up @@ -158,6 +158,39 @@ async def activevc(_, message: Message):
)


@app.on_message(filters.command("activevideo") & filters.user(SUDOERS))
async def activevi_(_, message: Message):
served_chats = []
try:
chats = await get_active_video_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 app.get_chat(x)).title
except Exception:
title = "Private Group"
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 message.reply_text("No Active Voice Chats")
else:
await message.reply_text(
f"**Active Video Calls:-**\n\n{text}",
disable_web_page_preview=True,
)


@app.on_message(filters.command("joinassistant") & filters.user(SUDOERS))
async def basffy(_, message):
if len(message.command) != 2:
Expand Down

0 comments on commit c689be0

Please sign in to comment.