From 2e24724e317535fe4b99ce1553ed8884c9dffbec Mon Sep 17 00:00:00 2001 From: Middledot Date: Thu, 3 Mar 2022 21:08:25 -0500 Subject: [PATCH] Support discord.Object in event locations --- discord/scheduled_events.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) 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