Skip to content

Commit

Permalink
Support discord.Object in event locations
Browse files Browse the repository at this point in the history
  • Loading branch information
Middledot committed Mar 4, 2022
1 parent bfdbfba commit 2e24724
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions discord/scheduled_events.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
from .errors import ValidationError
from .iterators import ScheduledEventSubscribersIterator
from .mixins import Hashable
from .object import Object

__all__ = (
"ScheduledEvent",
Expand Down Expand Up @@ -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.
Expand All @@ -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

Expand Down

0 comments on commit 2e24724

Please sign in to comment.