Skip to content
Merged
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
34 changes: 17 additions & 17 deletions discord/abc.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ async def _purge_messages_helper(
channel: TextChannel | StageChannel | Thread | VoiceChannel,
*,
limit: int | None = 100,
check: Callable[[Message], bool] = MISSING,
check: Callable[[Message], bool] | utils.Undefined = MISSING,
before: SnowflakeTime | None = None,
after: SnowflakeTime | None = None,
around: SnowflakeTime | None = None,
Expand Down Expand Up @@ -1031,43 +1031,43 @@ async def move(
self,
*,
beginning: bool,
offset: int = MISSING,
category: Snowflake | None = MISSING,
sync_permissions: bool = MISSING,
reason: str | None = MISSING,
offset: int | utils.Undefined = MISSING,
category: Snowflake | None | utils.Undefined = MISSING,
sync_permissions: bool | utils.Undefined = MISSING,
reason: str | None | utils.Undefined = MISSING,
) -> None: ...

@overload
async def move(
self,
*,
end: bool,
offset: int = MISSING,
category: Snowflake | None = MISSING,
sync_permissions: bool = MISSING,
reason: str = MISSING,
offset: int | utils.Undefined = MISSING,
category: Snowflake | None | utils.Undefined = MISSING,
sync_permissions: bool | utils.Undefined = MISSING,
reason: str | utils.Undefined = MISSING,
) -> None: ...

@overload
async def move(
self,
*,
before: Snowflake,
offset: int = MISSING,
category: Snowflake | None = MISSING,
sync_permissions: bool = MISSING,
reason: str = MISSING,
offset: int | utils.Undefined = MISSING,
category: Snowflake | None | utils.Undefined = MISSING,
sync_permissions: bool | utils.Undefined = MISSING,
reason: str | utils.Undefined = MISSING,
) -> None: ...

@overload
async def move(
self,
*,
after: Snowflake,
offset: int = MISSING,
category: Snowflake | None = MISSING,
sync_permissions: bool = MISSING,
reason: str = MISSING,
offset: int | utils.Undefined = MISSING,
category: Snowflake | None | utils.Undefined = MISSING,
sync_permissions: bool | utils.Undefined = MISSING,
reason: str | utils.Undefined = MISSING,
) -> None: ...

async def move(self, **kwargs) -> None:
Expand Down
6 changes: 3 additions & 3 deletions discord/application_role_connection.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
from typing import TYPE_CHECKING

from .enums import ApplicationRoleConnectionMetadataType, try_enum
from .utils import MISSING
from .utils import MISSING, Undefined

if TYPE_CHECKING:
from .types.application_role_connection import (
Expand Down Expand Up @@ -77,8 +77,8 @@ def __init__(
key: str,
name: str,
description: str,
name_localizations: dict[str, str] = MISSING,
description_localizations: dict[str, str] = MISSING,
name_localizations: dict[str, str] | Undefined = MISSING,
description_localizations: dict[str, str] | Undefined = MISSING,
):
self.type: ApplicationRoleConnectionMetadataType = type
self.key: str = key
Expand Down
6 changes: 3 additions & 3 deletions discord/asset.py
Original file line number Diff line number Diff line change
Expand Up @@ -333,9 +333,9 @@ def is_animated(self) -> bool:
def replace(
self,
*,
size: int = MISSING,
format: ValidAssetFormatTypes = MISSING,
static_format: ValidStaticFormatTypes = MISSING,
size: int | utils.Undefined = MISSING,
format: ValidAssetFormatTypes | utils.Undefined = MISSING,
static_format: ValidStaticFormatTypes | utils.Undefined = MISSING,
) -> Asset:
"""Returns a new asset with the passed components replaced.

Expand Down
30 changes: 15 additions & 15 deletions discord/automod.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,9 +92,9 @@ class AutoModActionMetadata:

def __init__(
self,
channel_id: int = MISSING,
timeout_duration: timedelta = MISSING,
custom_message: str = MISSING,
channel_id: int | utils.Undefined = MISSING,
timeout_duration: timedelta | utils.Undefined = MISSING,
custom_message: str | utils.Undefined = MISSING,
):
self.channel_id: int = channel_id
self.timeout_duration: timedelta = timeout_duration
Expand Down Expand Up @@ -247,11 +247,11 @@ class AutoModTriggerMetadata:

def __init__(
self,
keyword_filter: list[str] = MISSING,
regex_patterns: list[str] = MISSING,
presets: list[AutoModKeywordPresetType] = MISSING,
allow_list: list[str] = MISSING,
mention_total_limit: int = MISSING,
keyword_filter: list[str] | utils.Undefined = MISSING,
regex_patterns: list[str] | utils.Undefined = MISSING,
presets: list[AutoModKeywordPresetType] | utils.Undefined = MISSING,
allow_list: list[str] | utils.Undefined = MISSING,
mention_total_limit: int | utils.Undefined = MISSING,
):
self.keyword_filter = keyword_filter
self.regex_patterns = regex_patterns
Expand Down Expand Up @@ -483,13 +483,13 @@ async def delete(self, reason: str | None = None) -> None:
async def edit(
self,
*,
name: str = MISSING,
event_type: AutoModEventType = MISSING,
trigger_metadata: AutoModTriggerMetadata = MISSING,
actions: list[AutoModAction] = MISSING,
enabled: bool = MISSING,
exempt_roles: list[Snowflake] = MISSING,
exempt_channels: list[Snowflake] = MISSING,
name: str | utils.Undefined = MISSING,
event_type: AutoModEventType | utils.Undefined = MISSING,
trigger_metadata: AutoModTriggerMetadata | utils.Undefined = MISSING,
actions: list[AutoModAction] | utils.Undefined = MISSING,
enabled: bool | utils.Undefined = MISSING,
exempt_roles: list[Snowflake] | utils.Undefined = MISSING,
exempt_channels: list[Snowflake] | utils.Undefined = MISSING,
reason: str | None = None,
) -> AutoModRule | None:
"""|coro|
Expand Down
14 changes: 7 additions & 7 deletions discord/channel.py
Original file line number Diff line number Diff line change
Expand Up @@ -389,7 +389,7 @@ async def purge(
self,
*,
limit: int | None = 100,
check: Callable[[Message], bool] = MISSING,
check: Callable[[Message], bool] | utils.Undefined = MISSING,
before: SnowflakeTime | None = None,
after: SnowflakeTime | None = None,
around: SnowflakeTime | None = None,
Expand Down Expand Up @@ -864,7 +864,7 @@ async def create_thread(
*,
name: str,
message: Snowflake | None = None,
auto_archive_duration: ThreadArchiveDuration = MISSING,
auto_archive_duration: ThreadArchiveDuration | utils.Undefined = MISSING,
type: ChannelType | None = None,
slowmode_delay: int | None = None,
invitable: bool | None = None,
Expand Down Expand Up @@ -1193,8 +1193,8 @@ async def create_thread(
allowed_mentions=None,
view=None,
applied_tags=None,
auto_archive_duration: ThreadArchiveDuration = MISSING,
slowmode_delay: int = MISSING,
auto_archive_duration: ThreadArchiveDuration | utils.Undefined = MISSING,
slowmode_delay: int | utils.Undefined = MISSING,
reason: str | None = None,
) -> Thread:
"""|coro|
Expand Down Expand Up @@ -1868,7 +1868,7 @@ async def purge(
self,
*,
limit: int | None = 100,
check: Callable[[Message], bool] = MISSING,
check: Callable[[Message], bool] | utils.Undefined = MISSING,
before: SnowflakeTime | None = None,
after: SnowflakeTime | None = None,
around: SnowflakeTime | None = None,
Expand Down Expand Up @@ -2418,7 +2418,7 @@ async def purge(
self,
*,
limit: int | None = 100,
check: Callable[[Message], bool] = MISSING,
check: Callable[[Message], bool] | utils.Undefined = MISSING,
before: SnowflakeTime | None = None,
after: SnowflakeTime | None = None,
around: SnowflakeTime | None = None,
Expand Down Expand Up @@ -2599,7 +2599,7 @@ async def create_instance(
self,
*,
topic: str,
privacy_level: StagePrivacyLevel = MISSING,
privacy_level: StagePrivacyLevel | utils.Undefined = MISSING,
reason: str | None = None,
send_notification: bool | None = False,
) -> StageInstance:
Expand Down
10 changes: 5 additions & 5 deletions discord/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -1246,7 +1246,7 @@ def _check(*args):
return asyncio.wait_for(future, timeout)

# event registration
def add_listener(self, func: Coro, name: str = MISSING) -> None:
def add_listener(self, func: Coro, name: str | utils.Undefined = MISSING) -> None:
"""The non decorator alternative to :meth:`.listen`.

Parameters
Expand Down Expand Up @@ -1293,7 +1293,7 @@ async def my_message(message): pass
name,
)

def remove_listener(self, func: Coro, name: str = MISSING) -> None:
def remove_listener(self, func: Coro, name: str | utils.Undefined = MISSING) -> None:
"""Removes a listener from the pool of listeners.

Parameters
Expand All @@ -1313,7 +1313,7 @@ def remove_listener(self, func: Coro, name: str = MISSING) -> None:
except ValueError:
pass

def listen(self, name: str = MISSING, once: bool = False) -> Callable[[Coro], Coro]:
def listen(self, name: str | utils.Undefined = MISSING, once: bool = False) -> Callable[[Coro], Coro]:
"""A decorator that registers another function as an external
event listener. Basically this allows you to listen to multiple
events from different places e.g. such as :func:`.on_ready`
Expand Down Expand Up @@ -1597,8 +1597,8 @@ async def create_guild(
self,
*,
name: str,
icon: bytes = MISSING,
code: str = MISSING,
icon: bytes | utils.Undefined = MISSING,
code: str | utils.Undefined = MISSING,
) -> Guild:
"""|coro|

Expand Down
2 changes: 1 addition & 1 deletion discord/cog.py
Original file line number Diff line number Diff line change
Expand Up @@ -369,7 +369,7 @@ def _get_overridden_method(cls, method: FuncT) -> FuncT | None:

@classmethod
def listener(
cls, name: str = MISSING, once: bool = False
cls, name: str | discord.utils.Undefined = MISSING, once: bool = False
) -> Callable[[FuncT], FuncT]:
"""A decorator that marks a function as a listener.

Expand Down
4 changes: 2 additions & 2 deletions discord/commands/options.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
from ..enums import ChannelType
from ..enums import Enum as DiscordEnum
from ..enums import SlashCommandOptionType
from ..utils import MISSING, basic_autocomplete
from ..utils import MISSING, Undefined, basic_autocomplete

if TYPE_CHECKING:
from ..ext.commands import Converter
Expand Down Expand Up @@ -414,7 +414,7 @@ def __init__(
self,
name: str,
value: str | int | float | None = None,
name_localizations: dict[str, str] = MISSING,
name_localizations: dict[str, str] | Undefined = MISSING,
):
self.name = str(name)
self.value = value if value is not None else name
Expand Down
4 changes: 2 additions & 2 deletions discord/components.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@

from .enums import ButtonStyle, ChannelType, ComponentType, InputTextStyle, try_enum
from .partial_emoji import PartialEmoji, _EmojiTag
from .utils import MISSING, get_slots
from .utils import MISSING, Undefined, get_slots

if TYPE_CHECKING:
from .emoji import AppEmoji, GuildEmoji
Expand Down Expand Up @@ -410,7 +410,7 @@ def __init__(
self,
*,
label: str,
value: str = MISSING,
value: str | Undefined = MISSING,
description: str | None = None,
emoji: str | GuildEmoji | AppEmoji | PartialEmoji | None = None,
default: bool = False,
Expand Down
8 changes: 4 additions & 4 deletions discord/emoji.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
from .asset import Asset, AssetMixin
from .partial_emoji import PartialEmoji, _EmojiTag
from .user import User
from .utils import MISSING, SnowflakeList, snowflake_time
from .utils import MISSING, SnowflakeList, Undefined, snowflake_time

__all__ = (
"Emoji",
Expand Down Expand Up @@ -234,8 +234,8 @@ async def delete(self, *, reason: str | None = None) -> None:
async def edit(
self,
*,
name: str = MISSING,
roles: list[Snowflake] = MISSING,
name: str | Undefined = MISSING,
roles: list[Snowflake] | Undefined = MISSING,
reason: str | None = None,
) -> GuildEmoji:
r"""|coro|
Expand Down Expand Up @@ -383,7 +383,7 @@ async def delete(self) -> None:
async def edit(
self,
*,
name: str = MISSING,
name: str | Undefined = MISSING,
) -> AppEmoji:
r"""|coro|

Expand Down
3 changes: 2 additions & 1 deletion discord/ext/commands/bot.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
from typing import TYPE_CHECKING, Any, Callable, Coroutine, Iterable, TypeVar

import discord
from discord.utils import Undefined

from . import errors
from .context import Context
Expand Down Expand Up @@ -123,7 +124,7 @@ def __init__(
str | Iterable[str] | Coroutine[Any, Any, str | Iterable[str]],
]
) = when_mentioned,
help_command: HelpCommand | None = MISSING,
help_command: HelpCommand | None | Undefined = MISSING,
**options,
):
super().__init__(**options)
Expand Down
6 changes: 3 additions & 3 deletions discord/ext/commands/context.py
Original file line number Diff line number Diff line change
Expand Up @@ -125,12 +125,12 @@ def __init__(
message: Message,
bot: BotT,
view: StringView,
args: list[Any] = MISSING,
kwargs: dict[str, Any] = MISSING,
args: list[Any] | discord.utils.Undefined = MISSING,
kwargs: dict[str, Any] | discord.utils.Undefined = MISSING,
prefix: str | None = None,
command: Command | None = None,
invoked_with: str | None = None,
invoked_parents: list[str] = MISSING,
invoked_parents: list[str] | discord.utils.Undefined = MISSING,
invoked_subcommand: Command | None = None,
subcommand_passed: str | None = None,
command_failed: bool = False,
Expand Down
Loading