Files
Ultroid-fork/plugins/vctools.py
1Danish-00 6f44b386aa v0.2 11/10/2021
Co-authored-by: New-dev0 <New-dev0@users.noreply.github.com>
Co-authored-by: Amit Sharma <buddhhu@users.noreply.github.com>
Co-authored-by: TechiError <techierror@users.noreply.github.com>
Co-authored-by: Aditya <me@xditya.me>
Co-authored-by: Sonya Nikiforova <Sonniki@users.noreply.github.com>
Co-authored-by: M̲αραт <Marty2509@users.noreply.github.com>
Co-authored-by: Muhamad Risman Aziz <mrismanaziz@users.noreply.github.com>
Co-authored-by: Arnab Paryali <Arnabxd@users.noreply.github.com>
Co-authored-by: hellboi_atul <hellboi-atul@users.noreply.github.com>
Co-authored-by: sppidy <sppidy@users.noreply.github.com>
2021-10-11 00:27:23 +05:30

86 lines
2.1 KiB
Python

# Ultroid - UserBot
# Copyright (C) 2021 TeamUltroid
#
# This file is a part of < https://github.com/TeamUltroid/Ultroid/ >
# PLease read the GNU Affero General Public License in
# <https://www.github.com/TeamUltroid/Ultroid/blob/main/LICENSE/>.
"""
✘ Commands Available -
• `{i}startvc`
Start Group Call in a group.
• `{i}stopvc`
Stop Group Call in a group.
• `{i}vcinvite`
Invite all members of group in Group Call.
(You must be joined)
"""
from telethon.tl.functions.channels import GetFullChannelRequest as getchat
from telethon.tl.functions.phone import CreateGroupCallRequest as startvc
from telethon.tl.functions.phone import DiscardGroupCallRequest as stopvc
from telethon.tl.functions.phone import GetGroupCallRequest as getvc
from telethon.tl.functions.phone import InviteToGroupCallRequest as invitetovc
from . import eor, ultroid_cmd
async def get_call(event):
mm = await event.client(getchat(event.chat_id))
xx = await event.client(getvc(mm.full_chat.call))
return xx.call
def user_list(l, n):
for i in range(0, len(l), n):
yield l[i : i + n]
@ultroid_cmd(
pattern="stopvc$",
admins_only=True,
groups_only=True,
)
async def _(e):
try:
await e.client(stopvc(await get_call(e)))
await eor(e, "`Voice Chat Stopped...`")
except Exception as ex:
await eor(e, f"`{ex}`")
@ultroid_cmd(
pattern="vcinvite$",
groups_only=True,
)
async def _(e):
ok = await eor(e, "`Inviting Members to Voice Chat...`")
users = []
z = 0
async for x in e.client.iter_participants(e.chat_id):
if not x.bot:
users.append(x.id)
hmm = list(user_list(users, 6))
for p in hmm:
try:
await e.client(invitetovc(call=await get_call(e), users=p))
z += 6
except BaseException:
pass
await ok.edit(f"`Invited {z} users`")
@ultroid_cmd(
pattern="startvc$",
admins_only=True,
groups_only=True,
)
async def _(e):
try:
await e.client(startvc(e.chat_id))
await eor(e, "`Voice Chat Started...`")
except Exception as ex:
await eor(e, f"`{ex}`")