From ba1f95b6de5b2132dc9527eeae244a2ab290e140 Mon Sep 17 00:00:00 2001 From: levina <82658782+levina-lab@users.noreply.github.com> Date: Mon, 21 Feb 2022 12:18:37 +0700 Subject: [PATCH] [check] some fixes --- program/userbot_tools.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/program/userbot_tools.py b/program/userbot_tools.py index f03b7a4..f77c305 100644 --- a/program/userbot_tools.py +++ b/program/userbot_tools.py @@ -12,7 +12,7 @@ from pyrogram.types import Message from pyrogram import Client, filters from pyrogram.raw.types import InputPeerChannel from pyrogram.raw.functions.phone import CreateGroupCall -from pyrogram.errors import UserAlreadyParticipant, UserNotParticipant +from pyrogram.errors import UserAlreadyParticipant, UserNotParticipant, ChatAdminRequired @@ -95,6 +95,7 @@ async def leave_all(client, message): @authorized_users_only async def start_group_call(c: Client, m: Message): chat_id = m.chat.id + msg = await c.send_message(chat_id, "`starting...`") try: peer = await user.resolve_peer(chat_id) await user.send( @@ -106,11 +107,11 @@ async def start_group_call(c: Client, m: Message): random_id=user.rnd_id() // 9000000000, ) ) - msg = await c.send_message( - chat_id, "โœ… Group call started !" + await msg.edit_text("โœ… Group call started !") + except ChatAdminRequired: + await msg.edit_text( + "The userbot is not admin in this chat. To start the Group call you must promote the userbot as admin first with permission:\n\nยป โŒ manage_video_chats" ) - except Exception as e: - await msg.edit(f"๐Ÿšซ error: `{e}`") @Client.on_message(filters.left_chat_member)