From b7cfb4b5bc870417f0a87c71b61591bc9e6929bd Mon Sep 17 00:00:00 2001 From: Luna <161262151+GalacticalWolf@users.noreply.github.com> Date: Wed, 23 Apr 2025 20:12:41 +0100 Subject: [PATCH 1/6] Update joke.py --- techsupport_bot/commands/joke.py | 29 +++++++++++++++++++---------- 1 file changed, 19 insertions(+), 10 deletions(-) diff --git a/techsupport_bot/commands/joke.py b/techsupport_bot/commands/joke.py index 4e8f0d5c..6c0178b9 100644 --- a/techsupport_bot/commands/joke.py +++ b/techsupport_bot/commands/joke.py @@ -19,17 +19,28 @@ async def setup(bot: bot.TechSupportBot) -> None: Args: bot (bot.TechSupportBot): The bot object to register the cogs to """ + config = extensionconfig.ExtensionConfig() config.add( - key="pc_jokes", - datatype="bool", - title="Politically correct jokes only", + key="blacklisted_filters", + datatype="list[str]", + title="Enable filter", description=( - "True only politically correct jokes should be shown" - " (non-racist/non-sexist)" + "Filters all categories listed" + "(nsfw,religious,political,racist,sexist,explicit)" ), - default=True, + default=["nsfw","explicit"], ) + + config = extensionconfig.ExtensionConfig() + config.add( + key="apply_in_nsfw_channels", + datatype="bool", + title="Apply in NSFW Channels", + description=( + "Toggles whether or not filters are applies in NSFW channels" + ), + default=False, await bot.add_cog(Joker(bot=bot)) bot.add_extension_config("joke", config) @@ -75,10 +86,8 @@ def build_url(self: Self, ctx: commands.Context, config: munch.Munch) -> str: str: The URL, properly formatted and ready to be called """ blacklist_flags = [] - if not ctx.channel.is_nsfw(): - blacklist_flags.extend(["explicit", "nsfw"]) - if config.extensions.joke.pc_jokes.value: - blacklist_flags.extend(["sexist", "racist", "religious"]) + if apply_in_nsfw_channels or not ctx.channel.is_nsfw(): + blacklist_flags = config.blacklisted_filters blacklists = ",".join(blacklist_flags) url = f"{self.API_URL}?blacklistFlags={blacklists}&format=txt" From 6705d3f28f61191fb218f5605e97d1d7557db45f Mon Sep 17 00:00:00 2001 From: Luna <161262151+GalacticalWolf@users.noreply.github.com> Date: Wed, 23 Apr 2025 23:03:37 +0100 Subject: [PATCH 2/6] Update joke.py --- techsupport_bot/commands/joke.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/techsupport_bot/commands/joke.py b/techsupport_bot/commands/joke.py index 6c0178b9..072f704b 100644 --- a/techsupport_bot/commands/joke.py +++ b/techsupport_bot/commands/joke.py @@ -31,8 +31,6 @@ async def setup(bot: bot.TechSupportBot) -> None: ), default=["nsfw","explicit"], ) - - config = extensionconfig.ExtensionConfig() config.add( key="apply_in_nsfw_channels", datatype="bool", @@ -40,6 +38,7 @@ async def setup(bot: bot.TechSupportBot) -> None: description=( "Toggles whether or not filters are applies in NSFW channels" ), + ) default=False, await bot.add_cog(Joker(bot=bot)) bot.add_extension_config("joke", config) @@ -86,8 +85,8 @@ def build_url(self: Self, ctx: commands.Context, config: munch.Munch) -> str: str: The URL, properly formatted and ready to be called """ blacklist_flags = [] - if apply_in_nsfw_channels or not ctx.channel.is_nsfw(): - blacklist_flags = config.blacklisted_filters + if config.extensions.joke.apply_in_nsfw_channels.value or not ctx.channel.is_nsfw(): + blacklist_flags = config.extensions.joke.blacklisted_filters.value blacklists = ",".join(blacklist_flags) url = f"{self.API_URL}?blacklistFlags={blacklists}&format=txt" From f781ba1ba4540cc79de283f1225cf02e3c91e703 Mon Sep 17 00:00:00 2001 From: Luna <161262151+GalacticalWolf@users.noreply.github.com> Date: Thu, 24 Apr 2025 02:53:00 +0100 Subject: [PATCH 3/6] Update joke.py --- techsupport_bot/commands/joke.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/techsupport_bot/commands/joke.py b/techsupport_bot/commands/joke.py index 072f704b..f94ccc6e 100644 --- a/techsupport_bot/commands/joke.py +++ b/techsupport_bot/commands/joke.py @@ -38,8 +38,8 @@ async def setup(bot: bot.TechSupportBot) -> None: description=( "Toggles whether or not filters are applies in NSFW channels" ), - ) default=False, + ) await bot.add_cog(Joker(bot=bot)) bot.add_extension_config("joke", config) From 466fa66a40b11356cbf89301e9df351b786d5326 Mon Sep 17 00:00:00 2001 From: Luna <161262151+GalacticalWolf@users.noreply.github.com> Date: Thu, 24 Apr 2025 17:02:07 +0100 Subject: [PATCH 4/6] Update joke.py --- techsupport_bot/commands/joke.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/techsupport_bot/commands/joke.py b/techsupport_bot/commands/joke.py index f94ccc6e..8e26b380 100644 --- a/techsupport_bot/commands/joke.py +++ b/techsupport_bot/commands/joke.py @@ -29,7 +29,7 @@ async def setup(bot: bot.TechSupportBot) -> None: "Filters all categories listed" "(nsfw,religious,political,racist,sexist,explicit)" ), - default=["nsfw","explicit"], + default=["nsfw", "explicit"], ) config.add( key="apply_in_nsfw_channels", From 384bf938e285115e34fc53c779eff4ce97b32a4a Mon Sep 17 00:00:00 2001 From: Luna <161262151+GalacticalWolf@users.noreply.github.com> Date: Thu, 24 Apr 2025 17:12:56 +0100 Subject: [PATCH 5/6] Update joke.py --- techsupport_bot/commands/joke.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/techsupport_bot/commands/joke.py b/techsupport_bot/commands/joke.py index 8e26b380..2a09d41a 100644 --- a/techsupport_bot/commands/joke.py +++ b/techsupport_bot/commands/joke.py @@ -35,9 +35,7 @@ async def setup(bot: bot.TechSupportBot) -> None: key="apply_in_nsfw_channels", datatype="bool", title="Apply in NSFW Channels", - description=( - "Toggles whether or not filters are applies in NSFW channels" - ), + description=("Toggles whether or not filters are applies in NSFW channels"), default=False, ) await bot.add_cog(Joker(bot=bot)) @@ -85,7 +83,10 @@ def build_url(self: Self, ctx: commands.Context, config: munch.Munch) -> str: str: The URL, properly formatted and ready to be called """ blacklist_flags = [] - if config.extensions.joke.apply_in_nsfw_channels.value or not ctx.channel.is_nsfw(): + if ( + config.extensions.joke.apply_in_nsfw_channels.value + or not ctx.channel.is_nsfw() + ): blacklist_flags = config.extensions.joke.blacklisted_filters.value blacklists = ",".join(blacklist_flags) From 80a1932c4559ca94b04ff8bdd65adbcfac11a04c Mon Sep 17 00:00:00 2001 From: ajax146 <31014239+ajax146@users.noreply.github.com> Date: Thu, 24 Apr 2025 12:22:25 -0400 Subject: [PATCH 6/6] black --- techsupport_bot/commands/joke.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/techsupport_bot/commands/joke.py b/techsupport_bot/commands/joke.py index 2a09d41a..ce2892e9 100644 --- a/techsupport_bot/commands/joke.py +++ b/techsupport_bot/commands/joke.py @@ -86,7 +86,7 @@ def build_url(self: Self, ctx: commands.Context, config: munch.Munch) -> str: if ( config.extensions.joke.apply_in_nsfw_channels.value or not ctx.channel.is_nsfw() - ): + ): blacklist_flags = config.extensions.joke.blacklisted_filters.value blacklists = ",".join(blacklist_flags)