[func] create function
This commit is contained in:
parent
d56d0a025d
commit
cb89458b16
@ -2,6 +2,8 @@ import asyncio
|
|||||||
|
|
||||||
from config import BOT_USERNAME, SUDO_USERS
|
from config import BOT_USERNAME, SUDO_USERS
|
||||||
|
|
||||||
|
from program.utils.function import get_calls
|
||||||
|
|
||||||
from driver.core import user, me_bot
|
from driver.core import user, me_bot
|
||||||
from driver.filters import command, other_filters
|
from driver.filters import command, other_filters
|
||||||
from driver.database.dbchat import remove_served_chat
|
from driver.database.dbchat import remove_served_chat
|
||||||
@ -11,11 +13,10 @@ from driver.decorators import authorized_users_only, bot_creator, check_blacklis
|
|||||||
from pyrogram.types import Message
|
from pyrogram.types import Message
|
||||||
from pyrogram import Client, filters
|
from pyrogram import Client, filters
|
||||||
from pyrogram.raw.types import InputPeerChannel
|
from pyrogram.raw.types import InputPeerChannel
|
||||||
from pyrogram.raw.functions.phone import CreateGroupCall
|
from pyrogram.raw.functions.phone import CreateGroupCall, DiscardGroupCall
|
||||||
from pyrogram.errors import UserAlreadyParticipant, UserNotParticipant, ChatAdminRequired
|
from pyrogram.errors import UserAlreadyParticipant, UserNotParticipant, ChatAdminRequired
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@Client.on_message(
|
@Client.on_message(
|
||||||
command(["userbotjoin", f"userbotjoin@{BOT_USERNAME}"]) & other_filters
|
command(["userbotjoin", f"userbotjoin@{BOT_USERNAME}"]) & other_filters
|
||||||
)
|
)
|
||||||
@ -114,6 +115,26 @@ async def start_group_call(c: Client, m: Message):
|
|||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
@Client.on_message(command(["stopvc", f"stopvc@{BOT_USERNAME}"]) & other_filters)
|
||||||
|
@check_blacklist()
|
||||||
|
@authorized_users_only
|
||||||
|
async def stop_group_call(c: Client, m: Message):
|
||||||
|
chat_id = m.chat.id
|
||||||
|
msg = await c.send_message(chat_id, "`stopping...`")
|
||||||
|
if not (
|
||||||
|
group_call := (
|
||||||
|
await get_calls(m, err_msg=", group call is already ended.")
|
||||||
|
)
|
||||||
|
):
|
||||||
|
return
|
||||||
|
await user.send(
|
||||||
|
DiscardGroupCall(
|
||||||
|
call=group_call
|
||||||
|
)
|
||||||
|
)
|
||||||
|
await msg.edit_text("✅ Group call has ended !")
|
||||||
|
|
||||||
|
|
||||||
@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
|
||||||
|
Loading…
Reference in New Issue
Block a user