Skip to content

Commit 98e4b6a

Browse files
authored
Fix ScheduledEventLocation documentation (#725)
* Fix ScheduledEventLocation documentation * Correct table * Fix typing for location.value * Fix typing docs
1 parent 2661504 commit 98e4b6a

File tree

2 files changed

+15
-14
lines changed

2 files changed

+15
-14
lines changed

discord/scheduled_events.py

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -57,16 +57,21 @@
5757
class ScheduledEventLocation:
5858
"""Represents a scheduled event's location.
5959
60-
Setting the ``location`` to its corresponding type will set the location type automatically:
61-
- :class:`StageChannel`: :attr:`ScheduledEventLocationType.external`
62-
- :class:`VoiceChannel`: :attr:`ScheduledEventLocationType.voice`
63-
- :class:`str`: :attr:`ScheduledEventLocationType.external`
60+
Setting the ``value`` to its corresponding type will set the location type automatically:
61+
62+
+------------------------+---------------------------------------------------+
63+
| Type of Input | Location Type |
64+
+========================+===================================================+
65+
| :class:`StageChannel`: | :attr:`ScheduledEventLocationType.stage_instance` |
66+
| :class:`VoiceChannel`: | :attr:`ScheduledEventLocationType.voice` |
67+
| :class:`str`: | :attr:`ScheduledEventLocationType.external` |
68+
+------------------------+---------------------------------------------------+
6469
6570
.. versionadded:: 2.0
6671
6772
Attributes
6873
----------
69-
value: Union[:class:`str`, :class:`int`, :class:`StageChannel`, :class:`VoiceChannel`]
74+
value: Union[:class:`str`, :class:`StageChannel`, :class:`VoiceChannel`]
7075
The actual location of the scheduled event.
7176
type: :class:`ScheduledEventLocationType`
7277
The type of location.
@@ -77,12 +82,13 @@ class ScheduledEventLocation:
7782
'value',
7883
)
7984

80-
def __init__(self, *, state: ConnectionState, location: Union[str, int, StageChannel, VoiceChannel]):
85+
def __init__(self, *, state: ConnectionState, value: Union[str, int, StageChannel, VoiceChannel]):
8186
self._state = state
82-
if isinstance(location, int):
83-
self.value = self._state._get_guild_channel({"channel_id": int(location)})
87+
self.value: Union[str, StageChannel, VoiceChannel]
88+
if isinstance(value, int):
89+
self.value = self._state._get_guild_channel({"channel_id": int(value)})
8490
else:
85-
self.value = location
91+
self.value = value
8692

8793
def __repr__(self) -> str:
8894
return f"<ScheduledEventLocation value={self.value} type={self.type}>"

docs/api.rst

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3908,11 +3908,6 @@ ScheduledEvent
39083908
.. autoclass:: ScheduledEvent()
39093909
:members:
39103910

3911-
ScheduledEventLocation
3912-
~~~~~~~~~~~~~~~~~~~~~~~
3913-
3914-
..attributestable:: ScheduledEventLocation
3915-
39163911
.. autoclass:: ScheduledEventLocation()
39173912
:members:
39183913

0 commit comments

Comments
 (0)