Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

feat: add support for set topic on channels #839

Merged
merged 1 commit into from
Aug 9, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions AUTHORS
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,4 @@ And these fine folks have also made invaluable contributions to this project:
Alex.F <gfreezy@gmail.com>
Eren Güven <erenguven0@gmail.com>
Repudi8or <repudi8or@gmail.com>
Jogendra <jogendrafx@gmail.com>
4 changes: 4 additions & 0 deletions machine/clients/slack.py
Original file line number Diff line number Diff line change
Expand Up @@ -246,3 +246,7 @@ async def pin_message(self, channel: Channel | str, ts: str) -> AsyncSlackRespon
async def unpin_message(self, channel: Channel | str, ts: str) -> AsyncSlackResponse:
channel_id = id_for_channel(channel)
return await self._client.web_client.pins_remove(channel=channel_id, timestamp=ts)

async def set_topic(self, channel: Channel | str, topic: str, **kwargs: Any) -> AsyncSlackResponse:
channel_id = id_for_channel(channel)
return await self._client.web_client.channels_setTopic(channel=channel_id, topic=topic, **kwargs)
11 changes: 11 additions & 0 deletions machine/plugins/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -321,3 +321,14 @@ async def unpin_message(self, channel: Channel | str, ts: str) -> AsyncSlackResp
:return: response from the Slack Web API
"""
return await self._client.unpin_message(channel, ts)

async def set_topic(self, channel: Channel | str, topic: str, **kwargs: Any) -> AsyncSlackResponse:
"""Set channel topic

Set or update topic for the channel

:param channel: channel where topic needs to be set or updated
:param topic: topic for the channel (slack does not support formatting for topics)
:return: response from the Slack Web API
"""
return await self._client.set_topic(channel, topic, **kwargs)