Skip to content

Commit

Permalink
updated docs of get_moderators
Browse files Browse the repository at this point in the history
get_moderators now takes in a list of user_ids
  • Loading branch information
Teekeks committed Oct 9, 2020
1 parent ba4a850 commit d2f30dc
Showing 1 changed file with 18 additions and 7 deletions.
25 changes: 18 additions & 7 deletions twitchAPI/twitch.py
Original file line number Diff line number Diff line change
Expand Up @@ -769,22 +769,33 @@ def get_banned_users(self,

def get_moderators(self,
broadcaster_id: str,
user_id: Optional[str] = None,
user_ids: Optional[str] = None,
after: Optional[str] = None) -> dict:
"""Requires User authentication with scope :class:`~AuthScope.MODERATION_READ`\n
"""Returns all moderators in a channel.\n\n
Requires User authentication with scope :const:`twitchAPI.types.AuthScope.MODERATION_READ`\n
For detailed documentation, see here: https://dev.twitch.tv/docs/api/reference#get-moderators
:param broadcaster_id: str
:param user_id: optional str
:param after: optional str
:param str broadcaster_id: Provided broadcaster ID must match the user ID in the user auth token.
:param list[str] user_ids: Filters the results and only returns a status object for users who are moderator in
this channel and have a matching user_id. Maximum 100
:param str after: Cursor for forward pagination
:raises ~twitchAPI.types.UnauthorizedException: if user authentication is not set
:raises ~twitchAPI.types.MissingScopeException: if the user authentication is missing the required scope
:raises ~twitchAPI.types.TwitchAuthorizationException: if the used authentication token became invalid
and a re authentication failed
:raises ~twitchAPI.types.TwitchBackendException: if the Twitch API itself runs into problems
:raises ValueError: if user_ids has more than 100 entries
:rtype: dict
"""
if user_ids is not None and len(user_ids) > 100:
raise ValueError('user_ids can only be 100 entries long')
param = {
'broadcaster_id': broadcaster_id,
'user_id': user_id,
'user_id': user_ids,
'after': after
}
url = build_url(TWITCH_API_BASE_URL + 'moderation/moderators', param, remove_none=True)
url = build_url(TWITCH_API_BASE_URL + 'moderation/moderators', param, remove_none=True, split_lists=True)
result = self.__api_get_request(url, AuthType.USER, [AuthScope.MODERATION_READ])
return result.json()

Expand Down

0 comments on commit d2f30dc

Please sign in to comment.