Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ follows PEP-8 guidelines (mostly) with a column limit of 120.
## Use of "type: ignore" comments

In some cases, it might be necessary to ignore type checker warnings for one reason or
another. If that is that case, it is **required** that a comment is left explaining why
another. If that is the case, it is **required** that a comment is left explaining why
you are deciding to ignore type checking warnings.

### Licensing
Expand Down
2 changes: 1 addition & 1 deletion discord/appinfo.py
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ class AppInfo:
tags: Optional[List[:class:`str`]]
The list of tags describing the content and functionality of the app, if set.

Maximium of 5 tags.
Maximum of 5 tags.

.. versionadded:: 2.7

Expand Down
7 changes: 4 additions & 3 deletions discord/bot.py
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ def get_application_command(
name: :class:`str`
The qualified name of the command to get.
guild_ids: List[:class:`int`]
The guild ids associated to the command to get.
The guild ids associated with the command to get.
type: Type[:class:`.ApplicationCommand`]
The type of the command to get. Defaults to :class:`.ApplicationCommand`.

Expand Down Expand Up @@ -710,8 +710,9 @@ async def sync_commands(
commands in the most efficient way possible, unless ``force`` is set to ``True``, in which case it will always
register all commands.

By default, this coroutine is called inside the :func:`.on_connect` event. If you choose to override the
:func:`.on_connect` event, then you should invoke this coroutine as well such as the following:
By default, this coroutine is called inside the :func:`.on_connect` event. If the
:func:`.on_connect` event is overridden, this coroutine must be invoked manually,
as shown in the following example:

.. code-block:: python

Expand Down
30 changes: 13 additions & 17 deletions discord/commands/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -197,9 +197,7 @@ def __init__(self, func: Callable, **kwargs) -> None:
elif isinstance(cooldown, CooldownMapping):
buckets = cooldown
else:
raise TypeError(
"Cooldown must be a an instance of CooldownMapping or None."
)
raise TypeError("Cooldown must be an instance of CooldownMapping or None.")

self._buckets: CooldownMapping = buckets

Expand Down Expand Up @@ -717,7 +715,7 @@ class SlashCommand(ApplicationCommand):
integration_types: Set[:class:`IntegrationType`]
The type of installation this command should be available to. For instance, if set to
:attr:`IntegrationType.user_install`, the command will only be available to users with
the application installed on their account. Unapplicable for guild commands.
the application installed on their account. Not applicable for guild commands.
contexts: Set[:class:`InteractionContextType`]
The location where this command can be used. Cannot be set if this is a guild command.
"""
Expand Down Expand Up @@ -1222,9 +1220,9 @@ class SlashCommandGroup(ApplicationCommand):
integration_types: Set[:class:`IntegrationType`]
The type of installation this command should be available to. For instance, if set to
:attr:`IntegrationType.user_install`, the command will only be available to users with
the application installed on their account. Unapplicable for guild commands.
the application installed on their account. Not applicable for guild commands.
contexts: Set[:class:`InteractionContextType`]
The location where this command can be used. Unapplicable for guild commands.
The location where this command can be used. Not applicable for guild commands.
"""

__initial_commands__: list[SlashCommand | SlashCommandGroup]
Expand Down Expand Up @@ -1318,20 +1316,18 @@ def __init__(
# similar to ApplicationCommand
from ..ext.commands.cooldowns import BucketType, CooldownMapping, MaxConcurrency

# no need to getattr, since slash cmds groups cant be created using a decorator
# no need to getattr, since slash cmds groups can't be created using a decorator

if cooldown is None:
buckets = CooldownMapping(cooldown, BucketType.default)
elif isinstance(cooldown, CooldownMapping):
buckets = cooldown
else:
raise TypeError(
"Cooldown must be a an instance of CooldownMapping or None."
)
raise TypeError("Cooldown must be an instance of CooldownMapping or None.")

self._buckets: CooldownMapping = buckets

# no need to getattr, since slash cmds groups cant be created using a decorator
# no need to getattr, since slash cmds groups can't be created using a decorator

if max_concurrency is not None and not isinstance(
max_concurrency, MaxConcurrency
Expand Down Expand Up @@ -1654,9 +1650,9 @@ class ContextMenuCommand(ApplicationCommand):
The name localizations for this command. The values of this should be ``"locale": "name"``. See
`here <https://docs.discord.com/developers/reference#locales>`_ for a list of valid locales.
integration_types: Set[:class:`IntegrationType`]
The installation contexts where this command is available. Unapplicable for guild commands.
The installation contexts where this command is available. Not applicable for guild commands.
contexts: Set[:class:`InteractionContextType`]
The interaction contexts where this command is available. Unapplicable for guild commands.
The interaction contexts where this command is available. Not applicable for guild commands.
"""

def __new__(cls, *args, **kwargs) -> ContextMenuCommand:
Expand Down Expand Up @@ -1794,9 +1790,9 @@ class UserCommand(ContextMenuCommand):
The name localizations for this command. The values of this should be ``"locale": "name"``. See
`here <https://docs.discord.com/developers/reference#locales>`_ for a list of valid locales.
integration_types: Set[:class:`IntegrationType`]
The installation contexts where this command is available. Unapplicable for guild commands.
The installation contexts where this command is available. Not applicable for guild commands.
contexts: Set[:class:`InteractionContextType`]
The interaction contexts where this command is available. Unapplicable for guild commands.
The interaction contexts where this command is available. Not applicable for guild commands.
"""

type = 2
Expand Down Expand Up @@ -1909,9 +1905,9 @@ class MessageCommand(ContextMenuCommand):
The name localizations for this command. The values of this should be ``"locale": "name"``. See
`here <https://docs.discord.com/developers/reference#locales>`_ for a list of valid locales.
integration_types: Set[:class:`IntegrationType`]
The installation contexts where this command is available. Unapplicable for guild commands.
The installation contexts where this command is available. Not applicable for guild commands.
contexts: Set[:class:`InteractionContextType`]
The interaction contexts where this command is available. Unapplicable for guild commands.
The interaction contexts where this command is available. Not applicable for guild commands.
"""

type = 3
Expand Down
6 changes: 3 additions & 3 deletions discord/ext/bridge/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ class BridgeExtGroup(BridgeExtCommand, Group):


class BridgeCommand:
"""Compatibility class between prefixed-based commands and slash commands.
"""Compatibility class between prefix-based commands and slash commands.
Parameters
----------
Expand Down Expand Up @@ -341,7 +341,7 @@ def after_invoke(self, coro):


class BridgeCommandGroup(BridgeCommand):
"""Compatibility class between prefixed-based commands and slash commands.
"""Compatibility class between prefix-based commands and slash commands.
Parameters
----------
Expand Down Expand Up @@ -527,7 +527,7 @@ def is_nsfw():
.. warning::
In DMs, the prefixed-based command will always run as the user's privacy settings cannot be checked directly.
In DMs, the prefix-based command will always run as the user's privacy settings cannot be checked directly.
"""

def predicate(func: Callable | ApplicationCommand):
Expand Down
2 changes: 1 addition & 1 deletion discord/ext/commands/converter.py
Original file line number Diff line number Diff line change
Expand Up @@ -614,7 +614,7 @@ async def convert(self, ctx: Context, argument: str) -> discord.ForumChannel:


class ThreadConverter(IDConverter[discord.Thread]):
"""Coverts to a :class:`~discord.Thread`.
"""Converts to a :class:`~discord.Thread`.

All lookups are via the local guild.

Expand Down
4 changes: 1 addition & 3 deletions discord/ext/commands/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -378,9 +378,7 @@ def __init__(
elif isinstance(cooldown, CooldownMapping):
buckets = cooldown
else:
raise TypeError(
"Cooldown must be a an instance of CooldownMapping or None."
)
raise TypeError("Cooldown must be an instance of CooldownMapping or None.")
self._buckets: CooldownMapping = buckets

try:
Expand Down
2 changes: 1 addition & 1 deletion discord/ext/commands/flags.py
Original file line number Diff line number Diff line change
Expand Up @@ -632,7 +632,7 @@ def parse_flags(cls, argument: str) -> dict[str, list[str]]:
async def convert(cls: type[F], ctx: Context, argument: str) -> F:
"""|coro|

The method that actually converters an argument to the flag mapping.
The method that actually converts an argument to the flag mapping.

Parameters
----------
Expand Down
2 changes: 1 addition & 1 deletion discord/ext/pages/pagination.py
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ def __init__(
async def callback(self, interaction: discord.Interaction | None = None):
"""|coro|

The coroutine associated to a specific page. If `Paginator.page_action()` is used, this coroutine is called.
The coroutine associated with a specific page. If `Paginator.page_action()` is used, this coroutine is called.

Parameters
----------
Expand Down
12 changes: 6 additions & 6 deletions discord/poll.py
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ def emoji(self) -> GuildEmoji | AppEmoji | PartialEmoji | None:

@property
def count(self) -> int | None:
"""This answer's vote count, if recieved from Discord."""
"""This answer's vote count, if received from Discord."""
if not (self._poll and self.id):
return None
if self._poll.results is None:
Expand Down Expand Up @@ -189,7 +189,7 @@ def voters(
self, *, limit: int | None = None, after: Snowflake | None = None
) -> VoteIterator:
"""Returns an :class:`AsyncIterator` representing the users that have voted with this answer.
Only works if this poll was recieved from Discord.
Only works if this poll was received from Discord.

The ``after`` parameter must represent a member
and meet the :class:`abc.Snowflake` abc.
Expand All @@ -216,7 +216,7 @@ def voters(
HTTPException
Getting the voters for the answer failed.
RuntimeError
This poll wasn't recieved from a message.
This poll wasn't received from a message.

Examples
--------
Expand Down Expand Up @@ -336,7 +336,7 @@ class Poll:
layout_type: :class:`PollLayoutType`
The poll's layout type. Only one exists at the moment.
results: Optional[:class:`PollResults`]
The results of this poll recieved from Discord. If ``None``, this should be considered "unknown" rather than "no" results.
The results of this poll received from Discord. If ``None``, this should be considered "unknown" rather than "no" results.
"""

def __init__(
Expand Down Expand Up @@ -521,10 +521,10 @@ async def end(self) -> Message:
HTTPException
Ending this poll failed.
RuntimeError
This poll wasn't recieved from a message.
This poll wasn't received from a message.
"""

if not self._message:
raise RuntimeError("You can only end a poll recieved from a message.")
raise RuntimeError("You can only end a poll received from a message.")

return await self._message.end_poll()
2 changes: 1 addition & 1 deletion discord/raw_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -473,7 +473,7 @@ class RawVoiceChannelStatusUpdateEvent(_RawReprMixin):
guild_id: :class:`int`
The guild ID where the voice channel status update originated from.
status: Optional[:class:`str`]
The new new voice channel status.
The new voice channel status.
data: :class:`dict`
The raw data sent by the `gateway <https://docs.discord.com/developers/events/gateway-events-events#voice-channel-status-update>`__.
"""
Expand Down
2 changes: 1 addition & 1 deletion discord/reaction.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ def burst_colours(self) -> list[Colour]:
There is an alias for this named :attr:`burst_colors`.
"""

# We recieve a list of #FFFFFF, so omit the # and convert to base 16
# We receive a list of #FFFFFF, so omit the # and convert to base 16
return [Colour(int(c[1:], 16)) for c in self._burst_colours]

@property
Expand Down
2 changes: 1 addition & 1 deletion discord/role.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ def _parse_tag_int(data: RoleTagPayload, key: str) -> int | None:
"""
if value := data.get(key):
with suppress(ValueError):
# value error means it's not an number string (None or "")
# value error means it's not a number string (None or "")
return int(value) # pyright: ignore[reportUnknownArgumentType]
return None

Expand Down
8 changes: 4 additions & 4 deletions discord/ui/container.py
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@ def add_row(
----------
*items: Union[:class:`Button`, :class:`Select`]
The items this action row contains.
id: Optiona[:class:`int`]
id: Optional[:class:`int`]
The action row's ID.
"""

Expand Down Expand Up @@ -276,7 +276,7 @@ def add_text(self, content: str, id: int | None = None) -> Self:
----------
content: :class:`str`
The content of the TextDisplay
id: Optiona[:class:`int`]
id: Optional[:class:`int`]
The text displays' ID.
"""

Expand All @@ -297,7 +297,7 @@ def add_gallery(
----------
*items: :class:`MediaGalleryItem`
The media this gallery contains.
id: Optiona[:class:`int`]
id: Optional[:class:`int`]
The gallery's ID.
"""

Expand All @@ -314,7 +314,7 @@ def add_file(self, url: str, spoiler: bool = False, id: int | None = None) -> Se
The URL of this file's media. This must be an ``attachment://`` URL that references a :class:`~discord.File`.
spoiler: Optional[:class:`bool`]
Whether the file has the spoiler overlay. Defaults to ``False``.
id: Optiona[:class:`int`]
id: Optional[:class:`int`]
The file's ID.
"""

Expand Down
2 changes: 1 addition & 1 deletion discord/ui/file.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ def _generate_underlying(

@property
def file(self) -> UnfurledMediaItem:
"""The file's unerlying media item."""
"""The file's underlying media item."""
return self.underlying.file

@file.setter
Expand Down
2 changes: 1 addition & 1 deletion discord/ui/thumbnail.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ def _generate_underlying(

@property
def media(self) -> UnfurledMediaItem:
"""The thumbnail's unerlying media item."""
"""The thumbnail's underlying media item."""
return self.underlying.media

@media.setter
Expand Down
8 changes: 4 additions & 4 deletions discord/voice/_types.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ async def on_voice_state_update(self, data: RawVoiceStateUpdateEvent) -> None:
async def on_voice_server_update(self, data: RawVoiceServerUpdateEvent) -> None:
"""|coro|

A method called when the client's intially connecting to voice. This corresponds
A method called when the client is initially connecting to voice. This corresponds
to the ``VOICE_SERVER_UPDATE`` event.

Parameters
Expand All @@ -117,11 +117,11 @@ async def connect(self, *, timeout: float, reconnect: bool) -> None:
A method called to initialise the connection.

The library initialises this class and calls ``__init__``, and then :meth:`connect` when attempting
to start a connection to the voice. If an error ocurrs, it calls :meth:`disconnect`, so if you need
to start a connection to the voice. If an error occurs, it calls :meth:`disconnect`, so if you need
to implement any cleanup, you should manually call it in :meth:`disconnect` as the library will not
do so for you.

Within this method, to start the voice connection flow, it is recommened to use :meth:`Guild.change_voice_state`
Within this method, to start the voice connection flow, it is recommended to use :meth:`Guild.change_voice_state`
to start the flow. After which :meth:`on_voice_server_update` and :meth:`on_voice_state_update` will be called,
although this could vary and cause unexpected behaviour, but that falls under Discord's way of handling the voice
connection.
Expand All @@ -140,7 +140,7 @@ async def disconnect(self, *, force: bool) -> None:

A method called to terminate the voice connection.

This can be either called manually when forcing a disconnection, or when an exception in :meth:`connect` ocurrs.
This can be either called manually when forcing a disconnection, or when an exception in :meth:`connect` occurs.

It is recommended to call :meth:`cleanup` here.

Expand Down
10 changes: 5 additions & 5 deletions discord/voice/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ class VoiceClient(VoiceProtocol):
In order to use PCM based AudioSources, you must have the opus library
installed on your system and loaded through :func:`opus.load_opus`.
Otherwise, your AudioSources must be opus encoded (e.g. using :class:`FFmpegOpusAudio`)
or the library will not be able ot transmit audio.
or the library will not be able to transmit audio.
"""

def __init__(
Expand Down Expand Up @@ -342,9 +342,9 @@ def wait_until_connected(self, timeout: float | None = 30.0) -> bool:

@property
def latency(self) -> float:
"""Latency between a HEARTBEAT and a HEARBEAT_ACK in seconds.
"""Latency between a HEARTBEAT and a HEARTBEAT_ACK in seconds.

This chould be referred to as the Discord Voice WebSocket latency and is
This should be referred to as the Discord Voice WebSocket latency and is
and analogue of user's voice latencies as seen in the Discord client.

.. versionadded:: 1.4
Expand All @@ -354,7 +354,7 @@ def latency(self) -> float:

@property
def average_latency(self) -> float:
"""Average of most recent 20 HEARBEAT latencies in seconds.
"""Average of most recent 20 HEARTBEAT latencies in seconds.

.. versionadded:: 1.4
"""
Expand Down Expand Up @@ -708,7 +708,7 @@ def start_recording(
sink: :class:`~.Sink`
A Sink in which all audio packets will be processed in.
callback: Callable[[:class:`Exception` | None], Any]
A function which is called after the bot has stopped recording. This must take exactly one positonal(-only)
A function which is called after the bot has stopped recording. This must take exactly one positional(-only)
parameter, ``exception``, which is the exception that was raised during the recording of the Sink.

.. versionchanged:: 2.7
Expand Down
Loading
Loading