From 009b23c46611ab9eb93108ca36593f04c98aac5d Mon Sep 17 00:00:00 2001 From: levina <82658782+levina-lab@users.noreply.github.com> Date: Sun, 31 Oct 2021 19:53:10 +0700 Subject: [PATCH 1/2] add feature added unmute & mute feature --- program/admins.py | 42 +++++++++++++++++++++++++++++++++++++++--- 1 file changed, 39 insertions(+), 3 deletions(-) diff --git a/program/admins.py b/program/admins.py index 7759cee..1909654 100644 --- a/program/admins.py +++ b/program/admins.py @@ -1,11 +1,11 @@ from cache.admins import admins -from config import BOT_USERNAME, GROUP_SUPPORT, IMG_3, UPDATES_CHANNEL +from driver.veez import call_py +from pyrogram import Client, filters from driver.decorators import authorized_users_only from driver.filters import command, other_filters from driver.queues import QUEUE, clear_queue from driver.utils import skip_current_song, skip_item -from driver.veez import call_py -from pyrogram import Client +from config import BOT_USERNAME, GROUP_SUPPORT, IMG_3, UPDATES_CHANNEL from pyrogram.types import InlineKeyboardButton, InlineKeyboardMarkup, Message @@ -125,6 +125,42 @@ async def resume(client, m: Message): await m.reply("❌ **nothing in streaming**") +@Client.on_message( + command(["mute", f"mute@{BOT_USERNAME}", "vmute"]) & other_filters +) +@authorized_users_only +async def mute(client, m: Message): + chat_id = m.chat.id + if chat_id in QUEUE: + try: + await call_py.mute_stream(chat_id) + await m.reply( + "🔇 **Userbot muted.**\n\n• **To unmute the userbot, use the**\n» /unmute command." + ) + except Exception as e: + await m.reply(f"🚫 **error:**\n\n`{e}`") + else: + await m.reply("❌ **nothing in streaming**") + + +@Client.on_message( + command(["unmute", f"unmute@{BOT_USERNAME}", "vunmute"]) & other_filters +) +@authorized_users_only +async def unmute(client, m: Message): + chat_id = m.chat.id + if chat_id in QUEUE: + try: + await call_py.unmute_stream(chat_id) + await m.reply( + "🔊 **Userbot unmuted.**\n\n• **To mute the userbot, use the**\n» /mute command." + ) + except Exception as e: + await m.reply(f"🚫 **error:**\n\n`{e}`") + else: + await m.reply("❌ **nothing in streaming**") + + @Client.on_message( command(["volume", f"volume@{BOT_USERNAME}", "vol"]) & other_filters ) From 91bb747cd3f3f06eff1e198936c027ab2dea0937 Mon Sep 17 00:00:00 2001 From: levina <82658782+levina-lab@users.noreply.github.com> Date: Sun, 31 Oct 2021 20:28:53 +0700 Subject: [PATCH 2/2] feature info --- program/callback.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/program/callback.py b/program/callback.py index 6620821..ab9a608 100644 --- a/program/callback.py +++ b/program/callback.py @@ -134,6 +134,8 @@ async def cbadmin(_, query: CallbackQuery): » /resume - resume the stream » /skip - switch to next stream » /stop - stop the streaming +» /vmute - mute the userbot on voice chat +» /vunmute - unmute the userbot on voice chat » /reload - reload bot and refresh the admin data » /userbotjoin - invite the userbot to join group » /userbotleave - order userbot to leave from group