Skip to content

Commit

Permalink
feat: expose open_im for plugins
Browse files Browse the repository at this point in the history
  • Loading branch information
DonDebonair committed Nov 21, 2024
1 parent ff837a0 commit 21e2bba
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions machine/plugins/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -388,6 +388,18 @@ async def send_dm_scheduled(
when, user, text=text, attachments=attachments, blocks=blocks, **kwargs
)

async def open_im(self, users: User | str | list[User | str]) -> str:
"""Open a DM channel with one or more users
Open a DM channel with one or more users. If the DM channel already exists, the existing channel id
will be returned. If the DM channel does not exist, a new channel will be created and the
id of the new channel will be returned.
:param users: :py:class:`~machine.models.user.User` object or id of user to open DM with.
:return: id of the DM channel
"""
return await self._client.open_im(users)

Check warning on line 401 in machine/plugins/base.py

View check run for this annotation

Codecov / codecov/patch

machine/plugins/base.py#L401

Added line #L401 was not covered by tests

def emit(self, event: str, **kwargs: Any) -> None:
"""Emit an event
Expand Down

0 comments on commit 21e2bba

Please sign in to comment.