示例#1
0
 def send_in_thread(self, thread_ts: str):
     """ Sends threaded message.
     :param ts: Timestamp of the original parent message which thread belongs to.
     """
     return get_client(token=self.token).api_call('chat.postMessage',
                                                  thread_ts=thread_ts,
                                                  **self.message_params)
示例#2
0
 def send(self):
     return get_client(token=self.token).api_call(
         'files.upload',
         body_encoding='data',
         files={'file': self.file_path},
         **self.message_params,
     )
示例#3
0
 def update(self, ts):
     """
     Updates the message with the timestamp
     :param ts: Timestamp of the message to update
     """
     return get_client(token=self.token).api_call('chat.update',
                                                  ts=ts,
                                                  **self.message_params)
示例#4
0
 def send_ephemeral(self, user: User):
     return get_client(token=self.token).api_call(
         'chat.postEphemeral',
         body_encoding='json',
         channel=self.channel.id,
         text=self.text,
         attachments=self.attachments,
         blocks=self.blocks,
         user=user.id)
示例#5
0
 def send(self):
     return get_client(token=self.token).api_call(
         'dialog.open',
         body_encoding='json',
         dialog=self.dialog,
         trigger_id=self.trigger_id)
示例#6
0
 def open(self):
     return get_client(self.token).api_call('views.open',
                                            body_encoding='json',
                                            trigger_id=self.trigger_id,
                                            view=self.view)
示例#7
0
def get_default_client():
    try:
        return get_client()
    except NoSlackTokenError:
        return None
示例#8
0
 def using(cls, token):
     cls.client = get_client(token=token)
     return cls
示例#9
0
 def send(self):
     return get_client(token=self.token).api_call('chat.postMessage',
                                                  **self.message_params)