From 6b3ee1829cb6df6bc2b785e70b0674cb1f81711b Mon Sep 17 00:00:00 2001 From: Trygve Aaberge Date: Mon, 19 Feb 2024 15:48:30 +0100 Subject: Move set user profile functions --- slack/slack_api.py | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/slack/slack_api.py b/slack/slack_api.py index b687416..f70e2f4 100644 --- a/slack/slack_api.py +++ b/slack/slack_api.py @@ -268,20 +268,6 @@ class SlackApi(SlackApiCommon): raise SlackApiError(self.workspace, method, response, params) return response - async def _set_user_profile(self, profile: SlackSetProfile): - method = "users.profile.set" - body = {"profile": profile} - response: SlackUsersProfileSetResponse = await self._post(method, body) - if response["ok"] is False: - raise SlackApiError(self.workspace, method, response, body) - return response - - async def set_user_status(self, status: str): - return await self._set_user_profile({"status_text": status}) - - async def clear_user_status(self): - return await self._set_user_profile({"status_emoji": "", "status_text": ""}) - async def _fetch_users_info_without_splitting(self, user_ids: Iterable[str]): method = "users.info" params: Params = {"users": ",".join(user_ids)} @@ -492,3 +478,17 @@ class SlackApi(SlackApiCommon): 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} + response: SlackUsersProfileSetResponse = await self._post(method, body) + if response["ok"] is False: + raise SlackApiError(self.workspace, method, response, body) + return response + + async def set_user_status(self, status: str): + return await self._set_user_profile({"status_text": status}) + + async def clear_user_status(self): + return await self._set_user_profile({"status_emoji": "", "status_text": ""}) -- cgit