From 0491b734c0747fe1029dbd523e5befd1bfea6886 Mon Sep 17 00:00:00 2001 From: dkay Date: Sun, 19 Apr 2026 01:29:08 -0700 Subject: [PATCH 1/6] Check thread/forum channels for restricted factoids --- techsupport_bot/commands/factoids.py | 25 ++++++++++++++++--------- 1 file changed, 16 insertions(+), 9 deletions(-) diff --git a/techsupport_bot/commands/factoids.py b/techsupport_bot/commands/factoids.py index 5490f7f6d..0b324d47d 100644 --- a/techsupport_bot/commands/factoids.py +++ b/techsupport_bot/commands/factoids.py @@ -27,13 +27,14 @@ import discord import expiringdict import munch -import ui import yaml from aiohttp.client_exceptions import InvalidURL -from botlogging import LogContext, LogLevel -from core import auxiliary, cogs, custom_errors, extensionconfig from discord import app_commands from discord.ext import commands + +import ui +from botlogging import LogContext, LogLevel +from core import auxiliary, cogs, custom_errors, extensionconfig from functions import logger as function_logger if TYPE_CHECKING: @@ -831,12 +832,18 @@ async def response( if factoid.disabled: return - if ( - factoid.restricted - and str(ctx.channel.id) - not in config.extensions.factoids.restricted_list.value - ): - return + if factoid.restricted: + channel = ctx.channel + restricted_list = config.extensions.factoids.restricted_list.value + if isinstance(channel, discord.Thread): + if ( + str(channel.id) not in restricted_list + and str(channel.parent.id) not in restricted_list + ): + return + else: + if str(channel.id) not in restricted_list: + return if config.extensions.factoids.disable_embeds.value: embed = None From bca516e3f1042ec8644d5271e1410e7d0f24622f Mon Sep 17 00:00:00 2001 From: dkay Date: Sun, 19 Apr 2026 01:37:21 -0700 Subject: [PATCH 2/6] Fix formatting --- techsupport_bot/commands/animal.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/techsupport_bot/commands/animal.py b/techsupport_bot/commands/animal.py index 9062b583d..2a973a285 100644 --- a/techsupport_bot/commands/animal.py +++ b/techsupport_bot/commands/animal.py @@ -4,9 +4,10 @@ from typing import TYPE_CHECKING, Self -from core import auxiliary, cogs from discord.ext import commands +from core import auxiliary, cogs + if TYPE_CHECKING: import bot From 2daaba89f91c4818aa98ad39269d21e1300c04a2 Mon Sep 17 00:00:00 2001 From: dkay Date: Sun, 19 Apr 2026 02:50:14 -0700 Subject: [PATCH 3/6] Remove random animal change --- techsupport_bot/commands/animal.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/techsupport_bot/commands/animal.py b/techsupport_bot/commands/animal.py index 2a973a285..d6dcbb3f2 100644 --- a/techsupport_bot/commands/animal.py +++ b/techsupport_bot/commands/animal.py @@ -4,9 +4,9 @@ from typing import TYPE_CHECKING, Self +from core import auxiliary, cogs from discord.ext import commands -from core import auxiliary, cogs if TYPE_CHECKING: import bot From ba1f623ce1aa17dd6eeef4e06447f54d209ef2fa Mon Sep 17 00:00:00 2001 From: dkay Date: Sun, 19 Apr 2026 02:51:22 -0700 Subject: [PATCH 4/6] Update animal.py --- techsupport_bot/commands/animal.py | 1 - 1 file changed, 1 deletion(-) diff --git a/techsupport_bot/commands/animal.py b/techsupport_bot/commands/animal.py index d6dcbb3f2..9062b583d 100644 --- a/techsupport_bot/commands/animal.py +++ b/techsupport_bot/commands/animal.py @@ -7,7 +7,6 @@ from core import auxiliary, cogs from discord.ext import commands - if TYPE_CHECKING: import bot From 55c25f16cc6a74386357bcd58d7cba07b709a5db Mon Sep 17 00:00:00 2001 From: dkay Date: Sun, 19 Apr 2026 11:39:23 -0700 Subject: [PATCH 5/6] undo isort --- techsupport_bot/commands/factoids.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/techsupport_bot/commands/factoids.py b/techsupport_bot/commands/factoids.py index 0b324d47d..1673d4213 100644 --- a/techsupport_bot/commands/factoids.py +++ b/techsupport_bot/commands/factoids.py @@ -27,14 +27,13 @@ import discord import expiringdict import munch +import ui import yaml from aiohttp.client_exceptions import InvalidURL -from discord import app_commands -from discord.ext import commands - -import ui from botlogging import LogContext, LogLevel from core import auxiliary, cogs, custom_errors, extensionconfig +from discord import app_commands +from discord.ext import commands from functions import logger as function_logger if TYPE_CHECKING: From 6f18dece014959344f496a2ba8421a6dfce124b8 Mon Sep 17 00:00:00 2001 From: ajax146 <31014239+ajax146@users.noreply.github.com> Date: Fri, 12 Jun 2026 18:23:18 -0700 Subject: [PATCH 6/6] Update changelog. Formatting fixes --- changelog.md | 1 + modules/operation/factoids.py | 4 +++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/changelog.md b/changelog.md index 9f1fbcfa3..ac5314f37 100644 --- a/changelog.md +++ b/changelog.md @@ -87,6 +87,7 @@ Changes since 2026.06.04 - The /factoid call command now has an optional parameter to ping a member in the factoid display - Factoids called using /factoid call will now have a button to allow the invoker to delete the factoid - A new /factoid add command has been added, using a modal to create new factoids +- Fix restricted factoids not working in threads ### Forum - This changes the way the first message in a forum channel is obtained for initial post rejection detection diff --git a/modules/operation/factoids.py b/modules/operation/factoids.py index b19ac70ec..1e8fa1cea 100644 --- a/modules/operation/factoids.py +++ b/modules/operation/factoids.py @@ -816,7 +816,9 @@ async def response( if factoid.restricted: channel = ctx.channel - restricted_list = configuration.get_config_entry(ctx.guild.id, "factoids_restricted_list") + restricted_list = configuration.get_config_entry( + ctx.guild.id, "factoids_restricted_list" + ) if isinstance(channel, discord.Thread): if str(channel.parent.id) not in restricted_list: return