diff --git a/discord/scheduled_events.py b/discord/scheduled_events.py index 31263bdcb3..618eed2e4d 100644 --- a/discord/scheduled_events.py +++ b/discord/scheduled_events.py @@ -38,6 +38,7 @@ from .errors import ValidationError from .iterators import ScheduledEventSubscribersIterator from .mixins import Hashable +from .object import Object __all__ = ( "ScheduledEvent", @@ -73,7 +74,7 @@ class ScheduledEventLocation: Attributes ---------- - value: Union[:class:`str`, :class:`StageChannel`, :class:`VoiceChannel`] + value: Union[:class:`str`, :class:`StageChannel`, :class:`VoiceChannel`, :class:`Object`] The actual location of the scheduled event. type: :class:`ScheduledEventLocationType` The type of location. @@ -91,9 +92,9 @@ def __init__( value: Union[str, int, StageChannel, VoiceChannel], ): self._state = state - self.value: Union[str, StageChannel, VoiceChannel] + self.value: Union[str, StageChannel, VoiceChannel, Object] if isinstance(value, int): - self.value = self._state._get_guild_channel({"channel_id": int(value)}) + self.value = self._state.get_channel(id=int(value)) or Object(id=int(value)) else: self.value = value diff --git a/discord/stage_instance.py b/discord/stage_instance.py index 9f42c8c0ae..ea7c9ba632 100644 --- a/discord/stage_instance.py +++ b/discord/stage_instance.py @@ -74,6 +74,8 @@ class StageInstance(Hashable): The privacy level of the stage instance. discoverable_disabled: :class:`bool` Whether discoverability for the stage instance is disabled. + scheduled_event: Optional[:class:`.ScheduledEvent`] + The scheduled event linked with the stage instance, if any. """ __slots__ = ( @@ -84,6 +86,7 @@ class StageInstance(Hashable): "topic", "privacy_level", "discoverable_disabled", + "scheduled_event", "_cs_channel", ) @@ -98,6 +101,10 @@ def _update(self, data: StageInstancePayload): self.topic: str = data["topic"] self.privacy_level: StagePrivacyLevel = try_enum(StagePrivacyLevel, data["privacy_level"]) self.discoverable_disabled: bool = data.get("discoverable_disabled", False) + event_id = data.get("guild_scheduled_event") + if event_id is not None: + event_id = int(event_id) + self.scheduled_event = self.guild.get_scheduled_event(event_id) def __repr__(self) -> str: return f"" diff --git a/discord/types/channel.py b/discord/types/channel.py index 59a7eff6e9..c9f16ce7ff 100644 --- a/discord/types/channel.py +++ b/discord/types/channel.py @@ -164,3 +164,4 @@ class StageInstance(TypedDict): topic: str privacy_level: PrivacyLevel discoverable_disabled: bool + guild_scheduled_event_id: Snowflake