Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Implement /team/{teamId}/pm-all endpoint #56

Merged
merged 3 commits into from
Oct 29, 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 README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,7 @@ Most of the API is available:
client.teams.teams_of_player
client.teams.get_popular
client.teams.search
client.teams.message_all_members

client.tournaments.get
client.tournaments.get_tournament
Expand Down
10 changes: 10 additions & 0 deletions berserk/clients/teams.py
Original file line number Diff line number Diff line change
Expand Up @@ -121,3 +121,13 @@ def search(self, text: str, page: int = 1) -> PaginatedTeams:
path = "/api/team/search"
params: Params = {"text": text, "page": page}
return cast(PaginatedTeams, self._r.get(path, params=params))

def message_all_members(self, team_id: str, message: str) -> None:
"""Send a private message to all members of a team. You must be the team leader with the "Messages" permission.

:param team_id: team ID
:param message: message to send all team members
"""
path = f"/team/{team_id}/pm-all"
payload = {"message": message}
self._r.post(path=path, payload=payload)