From 60b1e4788deda18e9a4cf2865eb6fd3562a80b74 Mon Sep 17 00:00:00 2001 From: levina <82658782+levina-lab@users.noreply.github.com> Date: Mon, 21 Feb 2022 11:01:48 +0700 Subject: [PATCH] command create group call --- program/userbot_tools.py | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/program/userbot_tools.py b/program/userbot_tools.py index c38184d..93e20ec 100644 --- a/program/userbot_tools.py +++ b/program/userbot_tools.py @@ -58,7 +58,7 @@ async def leave_chat(_, m: Message): ) -@Client.on_message(command(["leaveall", f"leaveall@{BOT_USERNAME}"])) +@Client.on_message(command(["leaveall", f"leaveall@{BOT_USERNAME}"]) & ~filters.edited) @bot_creator async def leave_all(client, message): if message.from_user.id not in SUDO_USERS: @@ -88,6 +88,29 @@ async def leave_all(client, message): ) +@Client.on_message(command(["startvc", f"startvc@{BOT_USERNAME}"]) & other_filters) +@check_blacklist() +@authorized_users_only +async def start_group_call(c: Client, m: Message): + chat_id = m.chat.id + try: + peer = await user.resolve_peer(chat_id) + await user.send( + CreateGroupCall( + peer=InputPeerChannel( + channel_id=peer.channel_id, + access_hash=peer.access_hash, + ), + random_id=user.rnd_id() // 9000000000, + ) + ) + msg = await c.send_message( + chat_id, "✅ Group call started !" + ) + except Exception as e: + await msg.edit(f"🚫 error: `{e}`") + + @Client.on_message(filters.left_chat_member) async def bot_kicked(c: Client, m: Message): bot_id = me_bot.id