Skip to content

Commit 5051530

Browse files
committed
docs: 📝 Fixes (Pycord-Development#2892)
Signed-off-by: Paillat <[email protected]> Co-authored-by: Lala Sabathil <[email protected]> Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> (cherry picked from commit bc5b9a3) Signed-off-by: Paillat-dev <[email protected]>
1 parent 329ae2f commit 5051530

File tree

13 files changed

+51
-24
lines changed

13 files changed

+51
-24
lines changed

discord/channel.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2778,8 +2778,6 @@ class CategoryChannel(discord.abc.GuildChannel, Hashable):
27782778
The position in the category list. This is a number that starts at 0. e.g. the
27792779
top category is position 0. Can be ``None`` if the channel was received in an interaction.
27802780
2781-
.. note::
2782-
27832781
flags: :class:`ChannelFlags`
27842782
Extra features of the channel.
27852783

discord/client.py

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@
7777
if TYPE_CHECKING:
7878
from .abc import GuildChannel, PrivateChannel, Snowflake, SnowflakeTime
7979
from .channel import DMChannel
80-
from .interaction import Interaction
80+
from .interactions import Interaction
8181
from .member import Member
8282
from .message import Message
8383
from .poll import Poll
@@ -554,6 +554,15 @@ async def on_view_error(self, error: Exception, item: Item, interaction: Interac
554554
The default view error handler provided by the client.
555555
556556
This only fires for a view if you did not define its :func:`~discord.ui.View.on_error`.
557+
558+
Parameters
559+
----------
560+
error: :class:`Exception`
561+
The exception that was raised.
562+
item: :class:`Item`
563+
The item that the user interacted with.
564+
interaction: :class:`Interaction`
565+
The interaction that was received.
557566
"""
558567

559568
print(
@@ -569,6 +578,13 @@ async def on_modal_error(self, error: Exception, interaction: Interaction) -> No
569578
The default implementation prints the traceback to stderr.
570579
571580
This only fires for a modal if you did not define its :func:`~discord.ui.Modal.on_error`.
581+
582+
Parameters
583+
----------
584+
error: :class:`Exception`
585+
The exception that was raised.
586+
interaction: :class:`Interaction`
587+
The interaction that was received.
572588
"""
573589

574590
print(f"Ignoring exception in modal {interaction.modal}:", file=sys.stderr)
@@ -1270,7 +1286,7 @@ def add_listener(self, func: Coro, name: str | utils.Undefined = MISSING) -> Non
12701286
TypeError
12711287
The ``func`` parameter is not a coroutine function.
12721288
ValueError
1273-
The ``name`` (event name) does not start with 'on_'
1289+
The ``name`` (event name) does not start with ``on_``.
12741290
12751291
Example
12761292
-------
@@ -1339,7 +1355,7 @@ def listen(self, name: str | utils.Undefined = MISSING, once: bool = False) -> C
13391355
TypeError
13401356
The function being listened to is not a coroutine.
13411357
ValueError
1342-
The ``name`` (event name) does not start with 'on_'
1358+
The ``name`` (event name) does not start with ``on_``.
13431359
13441360
Example
13451361
-------

discord/components.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -676,7 +676,6 @@ def __str__(self) -> str:
676676

677677
@property
678678
def url(self) -> str:
679-
"""Returns this media item's url."""
680679
return self._url
681680

682681
@url.setter
@@ -778,7 +777,6 @@ def __init__(self, url, *, description=None, spoiler=False):
778777

779778
@property
780779
def url(self) -> str:
781-
"""Returns the URL of this gallery's underlying media item."""
782780
return self.media.url
783781

784782
def is_dispatchable(self) -> bool:

discord/ext/bridge/core.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -178,8 +178,10 @@ def __init__(self, callback, **kwargs):
178178
@property
179179
def name_localizations(self) -> dict[str, str] | None:
180180
"""Returns name_localizations from :attr:`slash_variant`
181-
You can edit/set name_localizations directly with
181+
You can edit/set name_localizations directly with
182+
182183
.. code-block:: python3
184+
183185
bridge_command.name_localizations["en-UK"] = ... # or any other locale
184186
# or
185187
bridge_command.name_localizations = {"en-UK": ..., "fr-FR": ...}
@@ -193,8 +195,10 @@ def name_localizations(self, value):
193195
@property
194196
def description_localizations(self) -> dict[str, str] | None:
195197
"""Returns description_localizations from :attr:`slash_variant`
196-
You can edit/set description_localizations directly with
198+
You can edit/set description_localizations directly with
199+
197200
.. code-block:: python3
201+
198202
bridge_command.description_localizations["en-UK"] = ... # or any other locale
199203
# or
200204
bridge_command.description_localizations = {"en-UK": ..., "fr-FR": ...}

discord/ext/commands/core.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1783,7 +1783,7 @@ def check_any(*checks: Check) -> Callable[[T], T]:
17831783
the :func:`check` decorator.
17841784
17851785
Raises
1786-
-------
1786+
------
17871787
TypeError
17881788
A check passed has not been decorated with the :func:`check`
17891789
decorator.

discord/guild.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,10 @@
5656
EntitlementOwnerType,
5757
NotificationLevel,
5858
NSFWLevel,
59+
OnboardingMode,
5960
ScheduledEventLocationType,
6061
ScheduledEventPrivacyLevel,
62+
SortOrder,
6163
VerificationLevel,
6264
VideoQualityMode,
6365
VoiceRegion,
@@ -105,6 +107,7 @@
105107
TextChannel,
106108
VoiceChannel,
107109
)
110+
from .onboarding import OnboardingPrompt
108111
from .permissions import Permissions
109112
from .state import ConnectionState
110113
from .template import Template
@@ -174,8 +177,6 @@ class Guild(Hashable):
174177
The channel that denotes the AFK channel. ``None`` if it doesn't exist.
175178
id: :class:`int`
176179
The guild's ID.
177-
invites_disabled: :class:`bool`
178-
Indicates if the guild invites are disabled.
179180
owner_id: :class:`int`
180181
The guild owner's ID. Use :attr:`Guild.owner` instead.
181182
unavailable: :class:`bool`
@@ -1143,7 +1144,7 @@ def created_at(self) -> datetime.datetime:
11431144

11441145
@property
11451146
def invites_disabled(self) -> bool:
1146-
"""Returns a boolean indicating if the guild invites are disabled."""
1147+
"""A boolean indicating whether the guild invites are disabled."""
11471148
return "INVITES_DISABLED" in self.features
11481149

11491150
def get_member_named(self, name: str, /) -> Member | None:
@@ -4352,7 +4353,7 @@ def entitlements(
43524353
exclude_ended=exclude_ended,
43534354
)
43544355

4355-
def get_sound(self, sound_id: int) -> Soundboard | None:
4356+
def get_sound(self, sound_id: int) -> SoundboardSound | None:
43564357
"""Returns a sound with the given ID.
43574358
43584359
.. versionadded :: 2.7

discord/raw_models.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@
4646
from .soundboard import PartialSoundboardSound, SoundboardSound
4747
from .state import ConnectionState
4848
from .threads import Thread
49+
from .types.channel import VoiceChannelEffectSendEvent as VoiceChannelEffectSend
4950
from .types.raw_models import (
5051
AuditLogEntryEvent,
5152
BulkMessageDeleteEvent,
@@ -62,9 +63,6 @@
6263
ThreadMembersUpdateEvent,
6364
ThreadUpdateEvent,
6465
TypingEvent,
65-
)
66-
from .types.raw_models import VoiceChannelEffectSendEvent as VoiceChannelEffectSend
67-
from .types.raw_models import (
6866
VoiceChannelStatusUpdateEvent,
6967
)
7068
from .types.raw_models import AutoModActionExecutionEvent as AutoModActionExecution

docs/api/data_classes.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ dynamic attributes in mind.
2828

2929
.. attributetable:: MediaGalleryItem
3030

31-
.. autoclass:: SelectOption
31+
.. autoclass:: MediaGalleryItem
3232
:members:
3333

3434
.. attributetable:: UnfurledMediaItem

docs/api/enums.rst

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2362,7 +2362,7 @@ of :class:`enum.Enum`.
23622362

23632363
.. attribute:: advanced
23642364

2365-
Both default channels and questions (``OnboardingPrompt``s) will count towards the Onboarding requirements.
2365+
Both default channels and questions (``OnboardingPrompt``\s) will count towards the Onboarding requirements.
23662366

23672367
.. class:: ReactionType
23682368

@@ -2572,3 +2572,15 @@ of :class:`enum.Enum`.
25722572
.. attribute:: large
25732573

25742574
The separator uses large padding.
2575+
2576+
.. class:: SortOrder
2577+
2578+
Used to represent the default sort order for posts in :class:`ForumChannel` and :class:`MediaChannel`.
2579+
2580+
.. attribute:: latest_activity
2581+
2582+
Sort by latest activity.
2583+
2584+
.. attribute:: creation_date
2585+
2586+
Sort by post creation date.

docs/api/events.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1456,9 +1456,9 @@ Soundboard Sound
14561456
.. versionadded:: 2.7
14571457

14581458
:param before: The soundboard sound prior to being updated.
1459-
:type before: :class:`Soundboard
1459+
:type before: :class:`Soundboard`
14601460
:param after: The soundboard sound after being updated.
1461-
:type after: :class:`Soundboard
1461+
:type after: :class:`Soundboard`
14621462

14631463
.. function:: on_raw_soundboard_sound_update(after)
14641464

0 commit comments

Comments
 (0)