create group call
This commit is contained in:
levina 2022-02-21 11:01:48 +07:00 committed by GitHub
parent febbfe5b57
commit 60b1e4788d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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 @bot_creator
async def leave_all(client, message): async def leave_all(client, message):
if message.from_user.id not in SUDO_USERS: 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) @Client.on_message(filters.left_chat_member)
async def bot_kicked(c: Client, m: Message): async def bot_kicked(c: Client, m: Message):
bot_id = me_bot.id bot_id = me_bot.id