diff --git a/csp_bot/backends/discord.py b/csp_bot/backends/discord.py index ee49b0c..0c0b910 100644 --- a/csp_bot/backends/discord.py +++ b/csp_bot/backends/discord.py @@ -20,4 +20,4 @@ class DiscordAdapterConfig(BaseModel): class DiscordMessage(Struct): _ignore: str = "" - mention_user_discord = lambda x: x # noqa: E731 + mention_user_discord = None diff --git a/csp_bot/backends/slack.py b/csp_bot/backends/slack.py index cd93ccc..b5845f4 100644 --- a/csp_bot/backends/slack.py +++ b/csp_bot/backends/slack.py @@ -21,4 +21,4 @@ class SlackAdapterConfig(BaseModel): class SlackMessage(Struct): _ignore: str = "" - mention_user_slack = lambda x: x # noqa: E731 + mention_user_slack = None diff --git a/csp_bot/backends/symphony.py b/csp_bot/backends/symphony.py index e47c06e..670655f 100644 --- a/csp_bot/backends/symphony.py +++ b/csp_bot/backends/symphony.py @@ -24,4 +24,4 @@ class SymphonyAdapterConfig(BaseModel): class SymphonyMessage(Struct): _ignore: str = "" - mention_user_symphony = lambda x: x # noqa: E731 + mention_user_symphony = None diff --git a/csp_bot/utils.py b/csp_bot/utils.py index 77b2278..0973c54 100644 --- a/csp_bot/utils.py +++ b/csp_bot/utils.py @@ -56,12 +56,18 @@ def recursive_format_for_message_ml(d): def mention_user(email_or_userid: str = "", backend: Backend = "symphony") -> str: if backend == "symphony": + if mention_user_symphony is None: + raise ImportError("Symphony adapter is not available.") return mention_user_symphony(email_or_userid) elif backend == "slack": if not email_or_userid.startswith("@"): email_or_userid = f"@{email_or_userid}" + if mention_user_slack is None: + raise ImportError("Slack adapter is not available.") return mention_user_slack(email_or_userid) elif backend == "discord": + if mention_user_discord is None: + raise ImportError("Discord adapter is not available.") return mention_user_discord(email_or_userid) else: raise NotImplementedError(f"Unsupported backend: {backend}")