From 510f5caabb0de6648694a6dd1c0578732f987020 Mon Sep 17 00:00:00 2001 From: levina <82658782+levina-lab@users.noreply.github.com> Date: Wed, 15 Sep 2021 12:06:38 +0700 Subject: [PATCH 1/2] start vc & stop vc function not finished yet, i will continue this tonight --- bot/userbotjoin.py | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/bot/userbotjoin.py b/bot/userbotjoin.py index 18a3fe5..4057ca0 100644 --- a/bot/userbotjoin.py +++ b/bot/userbotjoin.py @@ -3,6 +3,8 @@ import asyncio from pyrogram import Client, filters from pyrogram.errors import UserAlreadyParticipant +from pyrogram.raw.types import InputGroupCall +from pyrogram.raw.functions.phone import CreateGroupCall, DiscardGroupCall from helpers.filters import command from helpers.decorators import authorized_users_only, errors from bot.videoplayer import app as USER @@ -76,3 +78,24 @@ async def outall(client, message): await lol.edit(f"๐Ÿ” assistant leaving...\nโณ Left: {left} chats.\n\nโŒ Failed: {failed} chats.") await asyncio.sleep(0.7) await client.send_message(message.chat.id, f"โœ… Left {left} chats.\n\nโŒ Failed {failed} chats.") + + +@Client.on_message(command(["startvc", f"startvc@{Veez.BOT_USERNAME}"])) +async def start_vc(client, message): + chat_id = message.chat.id + try: + await USER.send(CreateGroupCall( + peer=(await USER.resolve_peer(chat_id)), + random_id=randint(10000, 999999999) + ) + ) + await message.reply("โœ… **voice chat started !**") + except Exception: + await message.reply( + "๐Ÿ’ก **I need to be an administrator with the permission:\n\nยป โŒ __Can manage voice chat__" + ) + + +@Client.on_message(command(["stopvc", f"stopvc@{Veez.BOT_USERNAME}"])) +async def stop_vc(client, message): + chat_id = message.chat.id From 6fadc1bea66fd1b5e57e40808935a8262a4d7264 Mon Sep 17 00:00:00 2001 From: levina <82658782+levina-lab@users.noreply.github.com> Date: Thu, 16 Sep 2021 12:22:09 +0700 Subject: [PATCH 2/2] testing --- bot/userbotjoin.py | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/bot/userbotjoin.py b/bot/userbotjoin.py index 4057ca0..2e3634d 100644 --- a/bot/userbotjoin.py +++ b/bot/userbotjoin.py @@ -4,7 +4,7 @@ import asyncio from pyrogram import Client, filters from pyrogram.errors import UserAlreadyParticipant from pyrogram.raw.types import InputGroupCall -from pyrogram.raw.functions.phone import CreateGroupCall, DiscardGroupCall +from pyrogram.raw.functions.phone import CreateGroupCall, DiscardGroupCall, GetGroupCall from helpers.filters import command from helpers.decorators import authorized_users_only, errors from bot.videoplayer import app as USER @@ -89,13 +89,8 @@ async def start_vc(client, message): random_id=randint(10000, 999999999) ) ) - await message.reply("โœ… **voice chat started !**") + await message.reply("โœ… **video chat started !**") except Exception: await message.reply( "๐Ÿ’ก **I need to be an administrator with the permission:\n\nยป โŒ __Can manage voice chat__" ) - - -@Client.on_message(command(["stopvc", f"stopvc@{Veez.BOT_USERNAME}"])) -async def stop_vc(client, message): - chat_id = message.chat.id