File tree 2 files changed +9
-9
lines changed
2 files changed +9
-9
lines changed Original file line number Diff line number Diff line change @@ -40,15 +40,9 @@ def run(verbose):
40
40
@run .command ()
41
41
def slack ():
42
42
"""Run the Slack bot demon."""
43
- from slack_bolt . adapter . socket_mode . async_handler import AsyncSocketModeHandler
43
+ from . slack import run_slack
44
44
45
- from .slack import get_app
46
-
47
- loop = asyncio .get_event_loop ()
48
-
49
- loop .run_until_complete (
50
- AsyncSocketModeHandler (get_app (), config .SLACK_APP_TOKEN ).start_async ()
51
- )
45
+ asyncio .run (run_slack ())
52
46
53
47
54
48
@cli .group (chain = True )
Original file line number Diff line number Diff line change 10
10
from datetime import datetime
11
11
from typing import Any
12
12
13
+ from slack_bolt .adapter .socket_mode .async_handler import AsyncSocketModeHandler
13
14
from slack_bolt .async_app import AsyncSay
14
15
from slack_sdk import errors
15
16
from slack_sdk .web .async_client import AsyncWebClient
@@ -203,11 +204,16 @@ def get_app(): # pragma: no cover
203
204
return app
204
205
205
206
207
+ async def run_slack ():
208
+ handler = AsyncSocketModeHandler (get_app (), config .SLACK_APP_TOKEN )
209
+ await handler .start_async ()
210
+
211
+
206
212
def fetch_coworker_contacts (_context = None ) -> str :
207
213
"""Fetch profile data about your coworkers from Slack.
208
214
209
215
The profiles include:
210
- - first & last name
216
+ - first a last name
211
217
- email address
212
218
- status
213
219
- pronouns
You can’t perform that action at this time.
0 commit comments