From 4be2eaff1f19046f555fe61568352ce38643b127 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rn-Michael=20Miehe?= Date: Sat, 2 Dec 2023 18:18:35 +0100 Subject: [PATCH] allow public/persistent posts in DM channels --- lenaverse_bot/core/verein.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/lenaverse_bot/core/verein.py b/lenaverse_bot/core/verein.py index 6a6f282..d750eaf 100644 --- a/lenaverse_bot/core/verein.py +++ b/lenaverse_bot/core/verein.py @@ -10,7 +10,15 @@ _logger = logging.getLogger(__name__) def reply_private(interaction: discord.Interaction, name: str) -> bool: _logger.debug(f"User {interaction.user.name}({interaction.user.id}) used /{name}") - return interaction.channel_id not in CONFIG.ev_info.channels + + # öffentliche Antwort in DM channels und in "allowed" channels + in_dm_channel = interaction.channel is not None and isinstance( + interaction.channel, discord.DMChannel + ) + in_allowed_channel = interaction.channel_id in CONFIG.ev_info.channels + + # private Antwort sonst + return not (in_dm_channel or in_allowed_channel) @functools.singledispatch