From 4b2635c03e959ca453fb291c8cd1c973d03ff835 Mon Sep 17 00:00:00 2001 From: dolfies Date: Sun, 23 Apr 2023 12:39:31 -0400 Subject: [PATCH] Parse scheduled event SKU IDs These are for ticketed events (which are dead), but are still in the API... --- discord/scheduled_event.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/discord/scheduled_event.py b/discord/scheduled_event.py index 4ffe80b74..750df9c66 100644 --- a/discord/scheduled_event.py +++ b/discord/scheduled_event.py @@ -25,7 +25,7 @@ DEALINGS IN THE SOFTWARE. from __future__ import annotations from datetime import datetime -from typing import TYPE_CHECKING, AsyncIterator, Dict, Optional, Union, overload, Literal +from typing import TYPE_CHECKING, AsyncIterator, Dict, List, Optional, Union, overload, Literal from .asset import Asset from .enums import EventStatus, EntityType, PrivacyLevel, ReadStateType, try_enum @@ -102,6 +102,10 @@ class ScheduledEvent(Hashable): The ID of the user that created the scheduled event. location: Optional[:class:`str`] The location of the scheduled event. + sku_ids: List[:class:`int`] + The IDs of the SKUs associated with the ticketed scheduled event. + + .. versionadded:: 2.1 """ __slots__ = ( @@ -123,6 +127,7 @@ class ScheduledEvent(Hashable): 'channel_id', 'creator_id', 'location', + 'sku_ids', ) def __init__(self, *, state: ConnectionState, data: GuildScheduledEventPayload) -> None: @@ -152,6 +157,7 @@ class ScheduledEvent(Hashable): self.end_time: Optional[datetime] = parse_time(data.get('scheduled_end_time')) self.channel_id: Optional[int] = _get_as_snowflake(data, 'channel_id') + self.sku_ids: List[int] = [int(sku_id) for sku_id in data.get('sku_ids', [])] metadata = data.get('entity_metadata') self._unroll_metadata(metadata)