diff --git a/ubot/command_handler.py b/ubot/command_handler.py index 82e52ec..03027df 100644 --- a/ubot/command_handler.py +++ b/ubot/command_handler.py @@ -33,6 +33,10 @@ class CommandHandler(): print(f"Attempted admin command ({event.text}) from ID {event.from_id}") continue + if value["nsfw"] and str(event.chat.id) in self.settings.get_list("nsfw_blacklist"): + print(f"Attempted NSFW command ({event.text}) in blacklisted chat ({event.chat_id}) from ID {event.from_id}") + continue + event.pattern_match = pattern_match event.args = pattern_match.groups()[-1] event.extras = value["extras"] diff --git a/ubot/settings.py b/ubot/settings.py index 0398455..7c03423 100644 --- a/ubot/settings.py +++ b/ubot/settings.py @@ -33,7 +33,8 @@ class Settings(): else: config_list = [] - config_list.append(value) + if value not in config_list: + config_list.append(value) self.config.set("DEFAULT", key, "|".join(config_list)) self.write_changes()