diff --git a/.github/PULL_REQUEST_TEMPLATE/pull_request_template.md b/.github/PULL_REQUEST_TEMPLATE.md similarity index 100% rename from .github/PULL_REQUEST_TEMPLATE/pull_request_template.md rename to .github/PULL_REQUEST_TEMPLATE.md diff --git a/changes/348.fixed b/changes/348.fixed new file mode 100644 index 00000000..ccd908f9 --- /dev/null +++ b/changes/348.fixed @@ -0,0 +1 @@ +Fixed failure when running slack socket mode. diff --git a/nautobot_chatops/sockets/slack.py b/nautobot_chatops/sockets/slack.py index e4482db7..5f95975a 100644 --- a/nautobot_chatops/sockets/slack.py +++ b/nautobot_chatops/sockets/slack.py @@ -4,6 +4,7 @@ import json import shlex +from asgiref.sync import sync_to_async from django.conf import settings from slack_sdk.socket_mode.aiohttp import SocketModeClient from slack_sdk.socket_mode.request import SocketModeRequest @@ -71,7 +72,7 @@ async def process_slash_command(client, req): client.logger.error("%s", err) return - registry = get_commands_registry() + registry = await sync_to_async(get_commands_registry)() if command not in registry: SlackDispatcher(context).send_markdown(commands_help(prefix=SLASH_PREFIX)) @@ -210,7 +211,7 @@ async def process_interactive(client, req): client.logger.info(f"command: {command}, subcommand: {subcommand}, params: {params}") - registry = get_commands_registry() + registry = await sync_to_async(get_commands_registry)() if command not in registry: SlackDispatcher(context).send_markdown(commands_help(prefix=SLASH_PREFIX)) @@ -241,7 +242,7 @@ async def process_mention(client, req): client.logger.error("%s", err) return - registry = get_commands_registry() + registry = await sync_to_async(get_commands_registry)() if command not in registry: SlackDispatcher(context).send_markdown(commands_help(prefix=SLASH_PREFIX))