mirror of
https://github.com/Nick80835/microbot
synced 2025-09-03 07:55:52 +00:00
yeet the fucking fuck
This commit is contained in:
@@ -47,8 +47,8 @@ class CommandHandler():
|
||||
|
||||
event.command = pattern_match.groups()[1]
|
||||
|
||||
if event.command in self.loader.db.get_disabled_commands(event.chat.id):
|
||||
print(f"Attempted command ({event.raw_text}) in chat which disabled it ({event.chat.id}) from ID {event.from_id}")
|
||||
if event.chat and not command.not_disableable and event.command in self.loader.db.get_disabled_commands(event.chat.id):
|
||||
print(f"Attempted command ({event.raw_text}) in chat which disabled it ({event.chat.id}) from ID {event.sender_id}")
|
||||
return
|
||||
|
||||
event.pattern_match = pattern_match
|
||||
@@ -64,7 +64,7 @@ class CommandHandler():
|
||||
pattern_match = search(self.inline_pattern_template.format(command.pattern + command.pattern_extra), event.text)
|
||||
|
||||
if pattern_match:
|
||||
if self.is_blacklisted(event, True):
|
||||
if self.is_blacklisted(event, True) and not self.is_owner(event) and not self.is_sudo(event):
|
||||
print(f"Attempted command ({event.text}) from blacklisted ID {event.from_id}")
|
||||
return
|
||||
|
||||
@@ -75,7 +75,7 @@ class CommandHandler():
|
||||
pattern_match = search(self.inline_pattern_template.format(command.pattern + command.pattern_extra), event.text)
|
||||
|
||||
if pattern_match:
|
||||
if self.is_blacklisted(event, True):
|
||||
if self.is_blacklisted(event, True) and not self.is_owner(event) and not self.is_sudo(event):
|
||||
print(f"Attempted command ({event.text}) from blacklisted ID {event.from_id}")
|
||||
return
|
||||
|
||||
@@ -222,27 +222,27 @@ class CommandHandler():
|
||||
print(f"Attempted sudo command ({event.raw_text}) from ID {event.from_id}")
|
||||
return False
|
||||
|
||||
if command.admin and not await self.is_admin(event) and not self.is_sudo(event) and not self.is_owner(event):
|
||||
if not event.chat and command.admin or event.chat and command.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 command.nsfw and str(event.chat.id) in self.settings.get_list("nsfw_blacklist"):
|
||||
if event.chat and command.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
|
||||
|
||||
if command.fun and str(event.chat.id) in self.settings.get_list("fun_blacklist"):
|
||||
if event.chat and command.fun and str(event.chat.id) in self.settings.get_list("fun_blacklist"):
|
||||
print(f"Attempted fun command ({event.raw_text}) in blacklisted chat ({event.chat.id}) from ID {event.from_id}")
|
||||
return False
|
||||
|
||||
return True
|
||||
|
||||
def is_owner(self, event):
|
||||
return bool(str(event.from_id) in self.settings.get_list("owner_id"))
|
||||
return bool(str(event.sender_id) in self.settings.get_list("owner_id"))
|
||||
|
||||
def is_sudo(self, event):
|
||||
return bool(str(event.from_id) in self.settings.get_list("sudo_users"))
|
||||
return bool(str(event.sender_id) in self.settings.get_list("sudo_users"))
|
||||
|
||||
async def is_admin(self, event):
|
||||
if event.is_private:
|
||||
@@ -255,6 +255,6 @@ class CommandHandler():
|
||||
if inline:
|
||||
user_id = event.query.user_id
|
||||
else:
|
||||
user_id = event.from_id
|
||||
user_id = event.sender_id
|
||||
|
||||
return bool(str(user_id) in self.settings.get_list("blacklisted_users"))
|
||||
|
Reference in New Issue
Block a user