Merge pull request #9 from levina-lab/beta

start vc function
This commit is contained in:
Zxce3 2021-09-16 12:46:33 +07:00 committed by GitHub
commit 08d871c204
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -3,6 +3,8 @@
import asyncio import asyncio
from pyrogram import Client, filters from pyrogram import Client, filters
from pyrogram.errors import UserAlreadyParticipant from pyrogram.errors import UserAlreadyParticipant
from pyrogram.raw.types import InputGroupCall
from pyrogram.raw.functions.phone import CreateGroupCall, DiscardGroupCall, GetGroupCall
from helpers.filters import command from helpers.filters import command
from helpers.decorators import authorized_users_only, errors from helpers.decorators import authorized_users_only, errors
from bot.videoplayer import app as USER from bot.videoplayer import app as USER
@ -76,3 +78,19 @@ async def outall(client, message):
await lol.edit(f"🔁 assistant leaving...\n⏳ Left: {left} chats.\n\n❌ Failed: {failed} chats.") await lol.edit(f"🔁 assistant leaving...\n⏳ Left: {left} chats.\n\n❌ Failed: {failed} chats.")
await asyncio.sleep(0.7) await asyncio.sleep(0.7)
await client.send_message(message.chat.id, f"✅ Left {left} chats.\n\n❌ Failed {failed} chats.") 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("✅ **video chat started !**")
except Exception:
await message.reply(
"💡 **I need to be an administrator with the permission:\n\n» ❌ __Can manage voice chat__"
)