Добавлен get_chat_settings

This commit is contained in:
2025-12-11 16:34:35 +03:00
parent 0d9ac981b8
commit f04916b7fd
2 changed files with 55 additions and 0 deletions

View File

@ -880,3 +880,36 @@ class TwitchAPIClient(AioHTTPXClient):
case _:
raise s.Error(req.status_code, 'Internal Server Error')
async def get_chat_settings(
self,
access_token: str,
broadcaster_id: int | str,
moderator_id: int | str | None = None,
cache_time: int | None = None,
):
req = await self.get(
'/chat/settings',
headers=self.clean_dict(
{
'Authorization': f'Bearer {access_token}',
'X-Cache-TTL': cache_time,
}
),
params=self.clean_dict(
{
'broadcaster_id': broadcaster_id,
'moderator_id': moderator_id,
}
),
)
match req.status_code:
case st.OK:
return s.ChatSettings.model_validate(req.json()).data
case st.BAD_REQUEST | st.UNAUTHORIZED:
raise s.Error(req.status_code, req.json()['message'])
case _:
raise s.Error(req.status_code, 'Internal Server Error')