Ultroid v0.0.8 | 17-6-21
Co-authored-by: Aditya <me@xditya.me> Co-authored-by: Danish <danish@ultroid.tech> 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> Co-authored-by: New-dev0 <New-dev0@users.noreply.github.com>
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
# Ultroid - UserBot
|
||||
# Copyright (C) 2020 TeamUltroid
|
||||
# Copyright (C) 2021 TeamUltroid
|
||||
#
|
||||
# This file is a part of < https://github.com/TeamUltroid/Ultroid/ >
|
||||
# PLease read the GNU Affero General Public License in
|
||||
@@ -18,8 +18,7 @@
|
||||
List all sudo users.
|
||||
"""
|
||||
|
||||
|
||||
from pyUltroid.misc._decorators import sed
|
||||
from pyUltroid.misc import sudoers
|
||||
|
||||
from . import *
|
||||
|
||||
@@ -31,15 +30,14 @@ async def _(ult):
|
||||
if not ult.out and not is_fullsudo(ult.sender_id):
|
||||
return await eod(ult, "`This Command is Sudo Restricted!..`")
|
||||
inputs = ult.pattern_match.group(1)
|
||||
if BOT_MODE and ult.sender_id != int(Redis(OWNER_ID)):
|
||||
if str(ult.sender_id) in sudoers():
|
||||
return await eod(ult, "`Sudo users can't add new sudos!`", time=10)
|
||||
ok = await eor(ult, "`Updating SUDO Users List ...`")
|
||||
mmm = ""
|
||||
if ult.reply_to_msg_id:
|
||||
replied_to = await ult.get_reply_message()
|
||||
id = await get_user_id(replied_to.sender_id)
|
||||
name = (await ult.client.get_entity(int(id))).first_name
|
||||
sed.append(id)
|
||||
mmm = ""
|
||||
if id == ultroid_bot.me.id:
|
||||
mmm += "You cant add yourself as Sudo User..."
|
||||
elif is_sudo(id):
|
||||
@@ -49,16 +47,12 @@ async def _(ult):
|
||||
mmm += f"**Added [{name}](tg://user?id={id}) as SUDO User**"
|
||||
else:
|
||||
mmm += "`SEEMS LIKE THIS FUNCTION CHOOSE TO BREAK ITSELF`"
|
||||
await eod(ok, mmm, time=5)
|
||||
|
||||
if inputs:
|
||||
elif inputs:
|
||||
id = await get_user_id(inputs)
|
||||
try:
|
||||
name = (await ult.client.get_entity(int(id))).first_name
|
||||
except BaseException:
|
||||
name = ""
|
||||
sed.append(id)
|
||||
mmm = ""
|
||||
if id == ultroid_bot.me.id:
|
||||
mmm += "You cant add yourself as Sudo User..."
|
||||
elif is_sudo(id):
|
||||
@@ -74,9 +68,9 @@ async def _(ult):
|
||||
mmm += f"**Added **`{id}`** as SUDO User**"
|
||||
else:
|
||||
mmm += "`SEEMS LIKE THIS FUNCTION CHOOSE TO BREAK ITSELF`"
|
||||
await eod(ok, mmm, time=5)
|
||||
else:
|
||||
return await eod(ok, "`Reply to a msg or add it's id/username.`", time=5)
|
||||
mmm += "`Reply to a msg or add it's id/username.`"
|
||||
await eod(ok, mmm)
|
||||
|
||||
|
||||
@ultroid_cmd(
|
||||
@@ -86,35 +80,29 @@ async def _(ult):
|
||||
if not ult.out and not is_fullsudo(ult.sender_id):
|
||||
return await eod(ult, "`This Command is Sudo Restricted!..`")
|
||||
inputs = ult.pattern_match.group(1)
|
||||
if BOT_MODE and ult.sender_id != int(Redis(OWNER_ID)):
|
||||
if str(ult.sender_id) in sudoers():
|
||||
return await eod(
|
||||
ult,
|
||||
"You are sudo user, You cant add other sudo user.",
|
||||
time=5,
|
||||
"You are sudo user, You cant remove other sudo user.",
|
||||
)
|
||||
ok = await eor(ult, "`Updating SUDO Users List ...`")
|
||||
mmm = ""
|
||||
if ult.reply_to_msg_id:
|
||||
replied_to = await ult.get_reply_message()
|
||||
id = await get_user_id(replied_to.sender_id)
|
||||
name = (await ult.client.get_entity(int(id))).first_name
|
||||
sed.remove(id)
|
||||
mmm = ""
|
||||
if not is_sudo(id):
|
||||
mmm += f"[{name}](tg://user?id={id}) `wasn't a SUDO User ...`"
|
||||
elif del_sudo(id):
|
||||
mmm += f"**Removed [{name}](tg://user?id={id}) from SUDO User(s)**"
|
||||
else:
|
||||
mmm += "`SEEMS LIKE THIS FUNCTION CHOOSE TO BREAK ITSELF`"
|
||||
await eod(ok, mmm, time=5)
|
||||
|
||||
if inputs:
|
||||
elif inputs:
|
||||
id = await get_user_id(inputs)
|
||||
try:
|
||||
name = (await ult.client.get_entity(int(id))).first_name
|
||||
except BaseException:
|
||||
name = ""
|
||||
sed.remove(id)
|
||||
mmm = ""
|
||||
if not is_sudo(id):
|
||||
if name != "":
|
||||
mmm += f"[{name}](tg://user?id={id}) `wasn't a SUDO User ...`"
|
||||
@@ -127,7 +115,9 @@ async def _(ult):
|
||||
mmm += f"**Removed **`{id}`** from SUDO User(s)**"
|
||||
else:
|
||||
mmm += "`SEEMS LIKE THIS FUNCTION CHOOSE TO BREAK ITSELF`"
|
||||
await eod(ok, mmm, time=5)
|
||||
else:
|
||||
mmm += "`Reply to a msg or add it's id/username.`"
|
||||
await eod(ok, mmm)
|
||||
|
||||
|
||||
@ultroid_cmd(
|
||||
@@ -155,6 +145,3 @@ async def _(ult):
|
||||
return await ok.edit(
|
||||
f"**SUDO MODE : {m}\n\nList of SUDO Users :**\n{msg}", link_preview=False
|
||||
)
|
||||
|
||||
|
||||
HELP.update({f"{__name__.split('.')[1]}": f"{__doc__.format(i=HNDLR)}"})
|
||||
|
||||
Reference in New Issue
Block a user