# 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
# .
"""
✘ Commands Available -
• `{i}lock `
Lock the Used Setting in Used Group.
• `{i}unlock `
UNLOCK the Used Setting in Used Group.
"""
from pyUltroid.functions.all import lucks, unlucks
from telethon.tl.functions.messages import EditChatDefaultBannedRightsRequest
from . import *
@ultroid_cmd(
pattern="lock ?(.*)",
groups_only=True,
admins_only=True,
type=["official", "manager"],
ignore_dualmode=True,
)
async def lockho(e):
mat = e.pattern_match.group(1)
if not mat:
return await eod(e, "`Give some Proper Input..`")
try:
ml = lucks(mat)
except BaseException:
return await eod(e, "`Incorrect Input`")
await e.client(EditChatDefaultBannedRightsRequest(e.chat_id, ml))
await eor(e, f"Locked - `{mat}` ! ")
@ultroid_cmd(
pattern="unlock ?(.*)",
groups_only=True,
admins_only=True,
type=["official", "manager"],
ignore_dualmode=True,
)
async def unlckho(e):
mat = e.pattern_match.group(1)
if not mat:
return await eod(e, "`Give some Proper Input..`")
try:
ml = unlucks(mat)
except BaseException:
return await eod(e, "`Incorrect Input`")
await e.client(EditChatDefaultBannedRightsRequest(e.chat_id, ml))
await eor(e, f"Unlocked - `{mat}` ! ")