Change abc.GuildChannel.overwrites to have Object keys if cache failed

Ultimately despite it not being the prettiest, Object keys ended up
being the sanest solution to this without destroying ergonomics.
This commit is contained in:
Rapptz
2022-08-06 14:46:52 -04:00
parent 1a361f4519
commit 6381b5a8f4
3 changed files with 25 additions and 18 deletions

View File

@ -38,6 +38,7 @@ from typing import (
TYPE_CHECKING,
Sequence,
Tuple,
TypeVar,
Union,
overload,
)
@ -72,6 +73,7 @@ if TYPE_CHECKING:
from .types.threads import ThreadArchiveDuration
from .role import Role
from .object import Object
from .member import Member, VoiceState
from .abc import Snowflake, SnowflakeTime
from .embeds import Embed
@ -96,6 +98,8 @@ if TYPE_CHECKING:
)
from .types.snowflake import SnowflakeList
OverwriteKeyT = TypeVar('OverwriteKeyT', Role, BaseUser, Object, Union[Role, Member, Object])
class ThreadWithMessage(NamedTuple):
thread: Thread
@ -293,7 +297,7 @@ class TextChannel(discord.abc.Messageable, discord.abc.GuildChannel, Hashable):
slowmode_delay: int = ...,
default_auto_archive_duration: ThreadArchiveDuration = ...,
type: ChannelType = ...,
overwrites: Mapping[Union[Role, Member, Snowflake], PermissionOverwrite] = ...,
overwrites: Mapping[OverwriteKeyT, PermissionOverwrite] = ...,
) -> TextChannel:
...
@ -1329,7 +1333,7 @@ class VoiceChannel(discord.abc.Messageable, VocalGuildChannel):
position: int = ...,
sync_permissions: int = ...,
category: Optional[CategoryChannel] = ...,
overwrites: Mapping[Union[Role, Member], PermissionOverwrite] = ...,
overwrites: Mapping[OverwriteKeyT, PermissionOverwrite] = ...,
rtc_region: Optional[str] = ...,
video_quality_mode: VideoQualityMode = ...,
reason: Optional[str] = ...,
@ -1629,7 +1633,7 @@ class StageChannel(VocalGuildChannel):
position: int = ...,
sync_permissions: int = ...,
category: Optional[CategoryChannel] = ...,
overwrites: Mapping[Union[Role, Member], PermissionOverwrite] = ...,
overwrites: Mapping[OverwriteKeyT, PermissionOverwrite] = ...,
rtc_region: Optional[str] = ...,
video_quality_mode: VideoQualityMode = ...,
reason: Optional[str] = ...,
@ -1802,7 +1806,7 @@ class CategoryChannel(discord.abc.GuildChannel, Hashable):
name: str = ...,
position: int = ...,
nsfw: bool = ...,
overwrites: Mapping[Union[Role, Member], PermissionOverwrite] = ...,
overwrites: Mapping[OverwriteKeyT, PermissionOverwrite] = ...,
reason: Optional[str] = ...,
) -> CategoryChannel:
...
@ -2114,7 +2118,7 @@ class ForumChannel(discord.abc.GuildChannel, Hashable):
slowmode_delay: int = ...,
default_auto_archive_duration: ThreadArchiveDuration = ...,
type: ChannelType = ...,
overwrites: Mapping[Union[Role, Member, Snowflake], PermissionOverwrite] = ...,
overwrites: Mapping[OverwriteKeyT, PermissionOverwrite] = ...,
) -> ForumChannel:
...