Fix a bug.

This commit is contained in:
xtao-dada 2022-03-02 22:55:29 +08:00
parent 9c273bca52
commit 70386a79a1
No known key found for this signature in database
GPG Key ID: 5189BADF099666E9
2 changed files with 12 additions and 7 deletions

View File

@ -10,8 +10,8 @@ async def start_bot():
LOGS.info("[INFO]: BOT & USERBOT CLIENT STARTED !!")
await calls.start()
LOGS.info("[INFO]: PY-TGCALLS CLIENT STARTED !!")
await user.join_chat("VeezSupportGroup")
await user.join_chat("levinachannel")
# await user.join_chat("VeezSupportGroup")
# await user.join_chat("levinachannel")
await idle()
LOGS.info("[INFO]: BOT & USERBOT STOPPED !!")
await bot.stop()

View File

@ -118,6 +118,11 @@ async def start_group_call(c: Client, m: Message):
chat_id = m.chat.id
msg = await c.send_message(chat_id, "`尝试开启视频聊天中...`")
try:
group_call = (
await get_calls(c, m, err_msg="")
)
if group_call:
raise FileExistsError
peer = await user.resolve_peer(chat_id)
await user.send(
CreateGroupCall(
@ -133,6 +138,8 @@ async def start_group_call(c: Client, m: Message):
await msg.edit_text(
"❌ 您需要首先赋予 userbot `管理语音聊天` 权限"
)
except FileExistsError:
await msg.edit_text("✅ 视频聊天未关闭")
@Client.on_message(command(["stopvc", f"stopvc@{BOT_USERNAME}"]) & other_filters)
@ -141,13 +148,11 @@ async def start_group_call(c: Client, m: Message):
async def stop_group_call(c: Client, m: Message):
chat_id = m.chat.id
msg = await c.send_message(chat_id, "`尝试关闭视频聊天中...`")
if not (
group_call := (
group_call = (
await get_calls(c, m, err_msg="group call not active")
)
):
await msg.edit_text("❌ 未开启视频聊天")
return
if not group_call:
return await msg.edit_text("❌ 未开启视频聊天")
await user.send(
DiscardGroupCall(
call=group_call