From a2d385bbdb7d6f2c1d7c8c9bdf9548832d8965a3 Mon Sep 17 00:00:00 2001 From: Trygve Aaberge Date: Mon, 19 Feb 2024 16:24:51 +0100 Subject: Add command `/slack mute` --- slack/slack_api.py | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'slack/slack_api.py') diff --git a/slack/slack_api.py b/slack/slack_api.py index f70e2f4..5c6a230 100644 --- a/slack/slack_api.py +++ b/slack/slack_api.py @@ -479,6 +479,14 @@ class SlackApi(SlackApiCommon): raise SlackApiError(self.workspace, method, response, params) return response + async def set_muted_channels(self, channel_ids: Iterable[str]): + method = "users.prefs.set" + params: Params = {"name": "muted_channels", "value": ",".join(channel_ids)} + response: SlackGenericResponse = await self._fetch(method, params) + if response["ok"] is False: + raise SlackApiError(self.workspace, method, response, params) + return response + async def _set_user_profile(self, profile: SlackSetProfile): method = "users.profile.set" body = {"profile": profile} -- cgit