forked from slackapi/bolt-python
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcontext.py
More file actions
35 lines (28 loc) · 967 Bytes
/
context.py
File metadata and controls
35 lines (28 loc) · 967 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
# pytype: skip-file
from typing import Optional
from slack_sdk import WebClient
from slack_bolt.context.ack import Ack
from slack_bolt.context.base_context import BaseContext
from slack_bolt.context.respond import Respond
from slack_bolt.context.say import Say
class BoltContext(BaseContext):
@property
def client(self) -> Optional[WebClient]:
if "client" not in self:
self["client"] = WebClient(token=None)
return self["client"]
@property
def ack(self) -> Ack:
if "ack" not in self:
self["ack"] = Ack()
return self["ack"]
@property
def say(self) -> Say:
if "say" not in self:
self["say"] = Say(client=self.client, channel=self.channel_id)
return self["say"]
@property
def respond(self) -> Optional[Respond]:
if "respond" not in self:
self["respond"] = Respond(response_url=self.response_url)
return self["respond"]