From 0328df1f79f2041b53d99524eb9fe3020dc77eda Mon Sep 17 00:00:00 2001 From: Nick80835 Date: Thu, 11 Feb 2021 10:47:08 -0500 Subject: [PATCH] allow customizing nsfw warnings --- ubot/command.py | 1 + ubot/command_handler.py | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/ubot/command.py b/ubot/command.py index f7e3a5d..25d97fb 100644 --- a/ubot/command.py +++ b/ubot/command.py @@ -18,6 +18,7 @@ class Command: self.sudo = args.get("sudo", False) self.admin = args.get("admin", False) self.nsfw = args.get("nsfw", False) + self.nsfw_warning = args.get("nsfw_warning", None) self.pass_nsfw = args.get("pass_nsfw", False) self.locking = args.get("locking", False) self.lock_reason = None diff --git a/ubot/command_handler.py b/ubot/command_handler.py index 764c309..7aaf788 100644 --- a/ubot/command_handler.py +++ b/ubot/command_handler.py @@ -223,7 +223,7 @@ class CommandHandler(): command.lock_reason = None elif command.user_locking: if event.sender_id in command.locked_users: - await event.reply(f"Please don't spam that command.") + await event.reply("Please don't spam that command.") return if command.chance and randint(0, 100) <= command.chance or not command.chance: @@ -269,7 +269,7 @@ class CommandHandler(): return False 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!") + await event.reply(command.nsfw_warning or "NSFW commands are disabled in this chat!") print(f"Attempted NSFW command ({event.raw_text}) in blacklisted chat ({event.chat.id}) from ID {event.sender_id}") return False