1.0.0: Релиз #1

Merged
Miwory merged 15 commits from dev into latest 2025-12-17 06:31:42 +03:00
3 changed files with 276 additions and 20 deletions
Showing only changes of commit f04916b7fd - Show all commits

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')

View File

@ -541,3 +541,25 @@ class ChannelChatBadges(BaseModel):
class GlobalChatBadges(ChannelChatBadges):
pass
class ChatSettingsData(BaseModel):
model_config = ConfigDict(extra='forbid')
broadcaster_id: int
emote_mode: bool
follower_mode: bool
follower_mode_duration: int | None
moderator_id: int | None = None
non_moderator_chat_delay: bool | None = None
non_moderator_chat_delay_duration: int | None = None
slow_mode: bool
slow_mode_wait_time: int | None
subscriber_mode: bool
unique_chat_mode: bool
class ChatSettings(BaseModel):
model_config = ConfigDict(extra='forbid')
data: list[ChatSettingsData]