mirror of
https://github.com/Nick80835/microbot
synced 2025-08-29 05:29:16 +00:00
fix errors in user perm commands, send a reaction on reload success
This commit is contained in:
parent
2673b5e5bc
commit
7c953725ab
@ -87,15 +87,16 @@ async def execute(event):
|
|||||||
|
|
||||||
@ldr.add("reload", sudo=True, hide_help=True)
|
@ldr.add("reload", sudo=True, hide_help=True)
|
||||||
async def reload_modules(event):
|
async def reload_modules(event):
|
||||||
reload_msg = await event.reply("Reloading modules…")
|
|
||||||
|
|
||||||
errors = ldr.reload_all_modules()
|
errors = ldr.reload_all_modules()
|
||||||
|
|
||||||
if errors:
|
if errors:
|
||||||
await reload_msg.edit(errors)
|
await event.reply(errors)
|
||||||
else:
|
else:
|
||||||
try:
|
try:
|
||||||
await reload_msg.edit("Successfully reloaded.")
|
try:
|
||||||
|
await event.react("👍")
|
||||||
|
except:
|
||||||
|
await event.reply("Successfully reloaded.")
|
||||||
except:
|
except:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
@ -177,11 +178,12 @@ async def shutdown(event):
|
|||||||
|
|
||||||
@ldr.add("blacklist", sudo=True, hide_help=True)
|
@ldr.add("blacklist", sudo=True, hide_help=True)
|
||||||
async def add_blacklist(event):
|
async def add_blacklist(event):
|
||||||
user_entity = await event.client.get_entity(await get_user(event))
|
user_entity = await get_user(event)
|
||||||
|
|
||||||
if not user_entity:
|
if not user_entity:
|
||||||
return
|
return
|
||||||
|
|
||||||
|
user_entity = await event.client.get_entity(user_entity)
|
||||||
userid = user_entity.id
|
userid = user_entity.id
|
||||||
userfullname = f"{user_entity.first_name} {user_entity.last_name or ''}".strip()
|
userfullname = f"{user_entity.first_name} {user_entity.last_name or ''}".strip()
|
||||||
|
|
||||||
@ -191,11 +193,12 @@ async def add_blacklist(event):
|
|||||||
|
|
||||||
@ldr.add("unblacklist", sudo=True, hide_help=True)
|
@ldr.add("unblacklist", sudo=True, hide_help=True)
|
||||||
async def rem_blacklist(event):
|
async def rem_blacklist(event):
|
||||||
user_entity = await event.client.get_entity(await get_user(event))
|
user_entity = await get_user(event)
|
||||||
|
|
||||||
if not user_entity:
|
if not user_entity:
|
||||||
return
|
return
|
||||||
|
|
||||||
|
user_entity = await event.client.get_entity(user_entity)
|
||||||
userid = user_entity.id
|
userid = user_entity.id
|
||||||
userfullname = f"{user_entity.first_name} {user_entity.last_name or ''}".strip()
|
userfullname = f"{user_entity.first_name} {user_entity.last_name or ''}".strip()
|
||||||
|
|
||||||
@ -212,11 +215,12 @@ async def show_blacklist(event):
|
|||||||
|
|
||||||
@ldr.add("sudo", owner=True, hide_help=True)
|
@ldr.add("sudo", owner=True, hide_help=True)
|
||||||
async def add_sudo(event):
|
async def add_sudo(event):
|
||||||
user_entity = await event.client.get_entity(await get_user(event))
|
user_entity = await get_user(event)
|
||||||
|
|
||||||
if not user_entity:
|
if not user_entity:
|
||||||
return
|
return
|
||||||
|
|
||||||
|
user_entity = await event.client.get_entity(user_entity)
|
||||||
userid = user_entity.id
|
userid = user_entity.id
|
||||||
userfullname = f"{user_entity.first_name} {user_entity.last_name or ''}".strip()
|
userfullname = f"{user_entity.first_name} {user_entity.last_name or ''}".strip()
|
||||||
|
|
||||||
@ -226,11 +230,12 @@ async def add_sudo(event):
|
|||||||
|
|
||||||
@ldr.add("unsudo", owner=True, hide_help=True)
|
@ldr.add("unsudo", owner=True, hide_help=True)
|
||||||
async def rem_sudo(event):
|
async def rem_sudo(event):
|
||||||
user_entity = await event.client.get_entity(await get_user(event))
|
user_entity = await get_user(event)
|
||||||
|
|
||||||
if not user_entity:
|
if not user_entity:
|
||||||
return
|
return
|
||||||
|
|
||||||
|
user_entity = await event.client.get_entity(user_entity)
|
||||||
userid = user_entity.id
|
userid = user_entity.id
|
||||||
userfullname = f"{user_entity.first_name} {user_entity.last_name or ''}".strip()
|
userfullname = f"{user_entity.first_name} {user_entity.last_name or ''}".strip()
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user