aboutsummaryrefslogtreecommitdiffstats
path: root/slack/slack_api.py
diff options
context:
space:
mode:
authorTrygve Aaberge <trygveaa@gmail.com>2023-10-14 23:51:41 +0200
committerTrygve Aaberge <trygveaa@gmail.com>2024-02-18 11:32:54 +0100
commit4143e3c8e907a67a4105ef7450a6523c20f4f0fe (patch)
tree2e1c48b02cd9ad0466b527685cb0a72a282df819 /slack/slack_api.py
parent2bf006184804104afe13bb11901c0d8674c3a1e2 (diff)
downloadwee-slack-4143e3c8e907a67a4105ef7450a6523c20f4f0fe.tar.gz
Support editing and deleting messages
Diffstat (limited to 'slack/slack_api.py')
-rw-r--r--slack/slack_api.py31
1 files changed, 31 insertions, 0 deletions
diff --git a/slack/slack_api.py b/slack/slack_api.py
index 784bea6..2264e36 100644
--- a/slack/slack_api.py
+++ b/slack/slack_api.py
@@ -319,6 +319,37 @@ class SlackApi(SlackApiCommon):
raise SlackApiError(self.workspace, method, response, params)
return response
+ async def chat_update_message(
+ self,
+ conversation: SlackConversation,
+ ts: SlackTs,
+ text: str,
+ ):
+ method = "chat.update"
+ params: Params = {
+ "channel": conversation.id,
+ "ts": ts,
+ "text": text,
+ "as_user": True,
+ "link_names": True,
+ }
+ response: SlackGenericResponse = await self._fetch(method, params)
+ if response["ok"] is False:
+ raise SlackApiError(self.workspace, method, response, params)
+ return response
+
+ async def chat_delete_message(self, conversation: SlackConversation, ts: SlackTs):
+ method = "chat.delete"
+ params: Params = {
+ "channel": conversation.id,
+ "ts": ts,
+ "as_user": True,
+ }
+ response: SlackGenericResponse = await self._fetch(method, params)
+ if response["ok"] is False:
+ raise SlackApiError(self.workspace, method, response, params)
+ return response
+
async def reactions_change(
self,
conversation: SlackConversation,