2
0
mirror of https://github.com/Nick80835/microbot synced 2025-09-02 23:45:37 +00:00

add warnings for insufficient permissions and nsfw being disabled

This commit is contained in:
Nick80835
2020-08-30 19:16:49 -04:00
parent 9dfe62bbaf
commit 31174ec859

View File

@@ -208,18 +208,22 @@ class CommandHandler():
return False
if value["owner"] and not self.is_owner(event):
await event.reply("You lack the permissions to use that command!")
print(f"Attempted owner command ({event.raw_text}) from ID {event.from_id}")
return False
if value["sudo"] and not self.is_sudo(event) and not self.is_owner(event):
await event.reply("You lack the permissions to use that command!")
print(f"Attempted sudo command ({event.raw_text}) from ID {event.from_id}")
return False
if value["admin"] and not await self.is_admin(event) and not self.is_sudo(event) and not self.is_owner(event):
await event.reply("You lack the permissions to use that command!")
print(f"Attempted admin command ({event.raw_text}) from ID {event.from_id}")
return False
if value["nsfw"] and str(event.chat.id) in self.settings.get_list("nsfw_blacklist"):
await event.reply("NSFW commands are disabled in this chat!")
print(f"Attempted NSFW command ({event.raw_text}) in blacklisted chat ({event.chat.id}) from ID {event.from_id}")
return False