mirror of
https://github.com/Nick80835/microbot
synced 2025-08-30 14:08:31 +00:00
fix ID sudoing and blacklisting
This commit is contained in:
@@ -60,6 +60,11 @@ async def shutdown(event):
|
|||||||
@ldr.add("blacklist", sudo=True)
|
@ldr.add("blacklist", sudo=True)
|
||||||
async def add_blacklist(event):
|
async def add_blacklist(event):
|
||||||
if event.args:
|
if event.args:
|
||||||
|
try:
|
||||||
|
event.args = int(event.args)
|
||||||
|
except:
|
||||||
|
pass
|
||||||
|
|
||||||
try:
|
try:
|
||||||
user_entity = await event.client.get_entity(event.args)
|
user_entity = await event.client.get_entity(event.args)
|
||||||
except (ValueError, TypeError):
|
except (ValueError, TypeError):
|
||||||
@@ -92,6 +97,11 @@ async def add_blacklist(event):
|
|||||||
@ldr.add("unblacklist", sudo=True)
|
@ldr.add("unblacklist", sudo=True)
|
||||||
async def rem_blacklist(event):
|
async def rem_blacklist(event):
|
||||||
if event.args:
|
if event.args:
|
||||||
|
try:
|
||||||
|
event.args = int(event.args)
|
||||||
|
except:
|
||||||
|
pass
|
||||||
|
|
||||||
try:
|
try:
|
||||||
user_entity = await event.client.get_entity(event.args)
|
user_entity = await event.client.get_entity(event.args)
|
||||||
except (ValueError, TypeError):
|
except (ValueError, TypeError):
|
||||||
@@ -134,6 +144,11 @@ async def show_blacklist(event):
|
|||||||
@ldr.add("sudo", owner=True)
|
@ldr.add("sudo", owner=True)
|
||||||
async def add_sudo(event):
|
async def add_sudo(event):
|
||||||
if event.args:
|
if event.args:
|
||||||
|
try:
|
||||||
|
event.args = int(event.args)
|
||||||
|
except:
|
||||||
|
pass
|
||||||
|
|
||||||
try:
|
try:
|
||||||
user_entity = await event.client.get_entity(event.args)
|
user_entity = await event.client.get_entity(event.args)
|
||||||
except (ValueError, TypeError):
|
except (ValueError, TypeError):
|
||||||
@@ -166,6 +181,11 @@ async def add_sudo(event):
|
|||||||
@ldr.add("unsudo", owner=True)
|
@ldr.add("unsudo", owner=True)
|
||||||
async def rem_sudo(event):
|
async def rem_sudo(event):
|
||||||
if event.args:
|
if event.args:
|
||||||
|
try:
|
||||||
|
event.args = int(event.args)
|
||||||
|
except:
|
||||||
|
pass
|
||||||
|
|
||||||
try:
|
try:
|
||||||
user_entity = await event.client.get_entity(event.args)
|
user_entity = await event.client.get_entity(event.args)
|
||||||
except (ValueError, TypeError):
|
except (ValueError, TypeError):
|
||||||
|
Reference in New Issue
Block a user