Добавлен get_global_emotes
This commit is contained in:
@ -753,7 +753,7 @@ class TwitchAPIClient(AioHTTPXClient):
|
|||||||
cache_time: int | None = None,
|
cache_time: int | None = None,
|
||||||
):
|
):
|
||||||
req = await self.get(
|
req = await self.get(
|
||||||
'/emotes',
|
'/chat/emotes',
|
||||||
headers=self.clean_dict(
|
headers=self.clean_dict(
|
||||||
{
|
{
|
||||||
'Authorization': f'Bearer {access_token}',
|
'Authorization': f'Bearer {access_token}',
|
||||||
@ -772,3 +772,26 @@ class TwitchAPIClient(AioHTTPXClient):
|
|||||||
|
|
||||||
case _:
|
case _:
|
||||||
raise s.Error(req.status_code, 'Internal Server Error')
|
raise s.Error(req.status_code, 'Internal Server Error')
|
||||||
|
|
||||||
|
async def get_global_emotes(
|
||||||
|
self, access_token: str, cache_time: int | None = None
|
||||||
|
):
|
||||||
|
req = await self.get(
|
||||||
|
'/chat/emotes/global',
|
||||||
|
headers=self.clean_dict(
|
||||||
|
{
|
||||||
|
'Authorization': f'Bearer {access_token}',
|
||||||
|
'X-Cache-TTL': cache_time,
|
||||||
|
}
|
||||||
|
),
|
||||||
|
)
|
||||||
|
|
||||||
|
match req.status_code:
|
||||||
|
case st.OK:
|
||||||
|
return s.GlobalEmotes.model_validate(req.json())
|
||||||
|
|
||||||
|
case st.UNAUTHORIZED:
|
||||||
|
raise s.Error(req.status_code, req.json()['message'])
|
||||||
|
|
||||||
|
case _:
|
||||||
|
raise s.Error(req.status_code, 'Internal Server Error')
|
||||||
|
|||||||
@ -503,3 +503,7 @@ class ChannelEmotes(BaseModel):
|
|||||||
|
|
||||||
data: list[ChannelEmote]
|
data: list[ChannelEmote]
|
||||||
template: str
|
template: str
|
||||||
|
|
||||||
|
|
||||||
|
class GlobalEmotes(ChannelEmotes):
|
||||||
|
pass
|
||||||
|
|||||||
Reference in New Issue
Block a user