Files
Ultroid-fork/plugins/vctools.py
Devesh Pal 6c7af44f09 Ultroid v0.1 Updates 13.09.2021
Co-authored-by: Danish <danish@ultroid.tech>
Co-authored-by: Aditya <me@xditya.me>
Co-authored-by: Amit Sharma <48654350+buddhhu@users.noreply.github.com>
Co-authored-by: sppidy <sppidy@users.noreply.github.com>
Co-authored-by: Arnab Paryali <Arnabxd@users.noreply.github.com>
Co-authored-by: divkix <divkix@users.noreply.github.com>
Co-authored-by: hellboi_atul <hellboi-atul@users.noreply.github.com>
Co-authored-by: Programming Error <error@notavailable.live>
2021-09-13 01:03:39 +05:30

88 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 *
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}`")