diff --git a/changelog.md b/changelog.md index 9f1fbcfa..ac5314f3 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 9e22159b..1e8fa1ce 100644 --- a/modules/operation/factoids.py +++ b/modules/operation/factoids.py @@ -814,12 +814,17 @@ async def response( if factoid.disabled: return - if factoid.restricted and str( - ctx.channel.id - ) not in configuration.get_config_entry( - ctx.guild.id, "factoids_restricted_list" - ): - return + if factoid.restricted: + channel = ctx.channel + 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 + else: + if str(channel.id) not in restricted_list: + return if configuration.get_config_entry(ctx.guild.id, "factoids_disable_embeds"): embed = None