Skip to content

Commit 0491b73

Browse files
committed
Check thread/forum channels for restricted factoids
1 parent 39bbd06 commit 0491b73

1 file changed

Lines changed: 16 additions & 9 deletions

File tree

techsupport_bot/commands/factoids.py

Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -27,13 +27,14 @@
2727
import discord
2828
import expiringdict
2929
import munch
30-
import ui
3130
import yaml
3231
from aiohttp.client_exceptions import InvalidURL
33-
from botlogging import LogContext, LogLevel
34-
from core import auxiliary, cogs, custom_errors, extensionconfig
3532
from discord import app_commands
3633
from discord.ext import commands
34+
35+
import ui
36+
from botlogging import LogContext, LogLevel
37+
from core import auxiliary, cogs, custom_errors, extensionconfig
3738
from functions import logger as function_logger
3839

3940
if TYPE_CHECKING:
@@ -831,12 +832,18 @@ async def response(
831832
if factoid.disabled:
832833
return
833834

834-
if (
835-
factoid.restricted
836-
and str(ctx.channel.id)
837-
not in config.extensions.factoids.restricted_list.value
838-
):
839-
return
835+
if factoid.restricted:
836+
channel = ctx.channel
837+
restricted_list = config.extensions.factoids.restricted_list.value
838+
if isinstance(channel, discord.Thread):
839+
if (
840+
str(channel.id) not in restricted_list
841+
and str(channel.parent.id) not in restricted_list
842+
):
843+
return
844+
else:
845+
if str(channel.id) not in restricted_list:
846+
return
840847

841848
if config.extensions.factoids.disable_embeds.value:
842849
embed = None

0 commit comments

Comments
 (0)