mirror of
https://github.com/Rapptz/discord.py.git
synced 2025-07-06 18:11:59 +00:00
Replace invariant container types with wider types where applicable
This commit is contained in:
parent
3e77a7b29e
commit
e01d4a31eb
@ -1206,7 +1206,7 @@ class Messageable:
|
|||||||
*,
|
*,
|
||||||
tts: bool = ...,
|
tts: bool = ...,
|
||||||
embed: Embed = ...,
|
embed: Embed = ...,
|
||||||
files: List[File] = ...,
|
files: Sequence[File] = ...,
|
||||||
stickers: Sequence[Union[GuildSticker, StickerItem]] = ...,
|
stickers: Sequence[Union[GuildSticker, StickerItem]] = ...,
|
||||||
delete_after: float = ...,
|
delete_after: float = ...,
|
||||||
nonce: Union[str, int] = ...,
|
nonce: Union[str, int] = ...,
|
||||||
@ -1224,7 +1224,7 @@ class Messageable:
|
|||||||
content: Optional[str] = ...,
|
content: Optional[str] = ...,
|
||||||
*,
|
*,
|
||||||
tts: bool = ...,
|
tts: bool = ...,
|
||||||
embeds: List[Embed] = ...,
|
embeds: Sequence[Embed] = ...,
|
||||||
file: File = ...,
|
file: File = ...,
|
||||||
stickers: Sequence[Union[GuildSticker, StickerItem]] = ...,
|
stickers: Sequence[Union[GuildSticker, StickerItem]] = ...,
|
||||||
delete_after: float = ...,
|
delete_after: float = ...,
|
||||||
@ -1243,8 +1243,8 @@ class Messageable:
|
|||||||
content: Optional[str] = ...,
|
content: Optional[str] = ...,
|
||||||
*,
|
*,
|
||||||
tts: bool = ...,
|
tts: bool = ...,
|
||||||
embeds: List[Embed] = ...,
|
embeds: Sequence[Embed] = ...,
|
||||||
files: List[File] = ...,
|
files: Sequence[File] = ...,
|
||||||
stickers: Sequence[Union[GuildSticker, StickerItem]] = ...,
|
stickers: Sequence[Union[GuildSticker, StickerItem]] = ...,
|
||||||
delete_after: float = ...,
|
delete_after: float = ...,
|
||||||
nonce: Union[str, int] = ...,
|
nonce: Union[str, int] = ...,
|
||||||
@ -1262,9 +1262,9 @@ class Messageable:
|
|||||||
*,
|
*,
|
||||||
tts: bool = False,
|
tts: bool = False,
|
||||||
embed: Optional[Embed] = None,
|
embed: Optional[Embed] = None,
|
||||||
embeds: Optional[List[Embed]] = None,
|
embeds: Optional[Sequence[Embed]] = None,
|
||||||
file: Optional[File] = None,
|
file: Optional[File] = None,
|
||||||
files: Optional[List[File]] = None,
|
files: Optional[Sequence[File]] = None,
|
||||||
stickers: Optional[Sequence[Union[GuildSticker, StickerItem]]] = None,
|
stickers: Optional[Sequence[Union[GuildSticker, StickerItem]]] = None,
|
||||||
delete_after: Optional[float] = None,
|
delete_after: Optional[float] = None,
|
||||||
nonce: Optional[Union[str, int]] = None,
|
nonce: Optional[Union[str, int]] = None,
|
||||||
|
@ -23,7 +23,7 @@ DEALINGS IN THE SOFTWARE.
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
from typing import Any, Iterator, List, Optional, TYPE_CHECKING, Tuple
|
from typing import Any, Collection, Iterator, List, Optional, TYPE_CHECKING, Tuple
|
||||||
|
|
||||||
from .asset import Asset, AssetMixin
|
from .asset import Asset, AssetMixin
|
||||||
from .utils import SnowflakeList, snowflake_time, MISSING
|
from .utils import SnowflakeList, snowflake_time, MISSING
|
||||||
@ -214,7 +214,9 @@ class Emoji(_EmojiTag, AssetMixin):
|
|||||||
|
|
||||||
await self._state.http.delete_custom_emoji(self.guild_id, self.id, reason=reason)
|
await self._state.http.delete_custom_emoji(self.guild_id, self.id, reason=reason)
|
||||||
|
|
||||||
async def edit(self, *, name: str = MISSING, roles: List[Snowflake] = MISSING, reason: Optional[str] = None) -> Emoji:
|
async def edit(
|
||||||
|
self, *, name: str = MISSING, roles: Collection[Snowflake] = MISSING, reason: Optional[str] = None
|
||||||
|
) -> Emoji:
|
||||||
r"""|coro|
|
r"""|coro|
|
||||||
|
|
||||||
Edits the custom emoji.
|
Edits the custom emoji.
|
||||||
|
@ -31,9 +31,11 @@ from typing import (
|
|||||||
Any,
|
Any,
|
||||||
AsyncIterator,
|
AsyncIterator,
|
||||||
ClassVar,
|
ClassVar,
|
||||||
|
Collection,
|
||||||
Coroutine,
|
Coroutine,
|
||||||
Dict,
|
Dict,
|
||||||
List,
|
List,
|
||||||
|
Mapping,
|
||||||
NamedTuple,
|
NamedTuple,
|
||||||
Sequence,
|
Sequence,
|
||||||
Set,
|
Set,
|
||||||
@ -1063,7 +1065,7 @@ class Guild(Hashable):
|
|||||||
self,
|
self,
|
||||||
name: str,
|
name: str,
|
||||||
channel_type: Literal[ChannelType.text],
|
channel_type: Literal[ChannelType.text],
|
||||||
overwrites: Dict[Union[Role, Member], PermissionOverwrite] = ...,
|
overwrites: Mapping[Union[Role, Member], PermissionOverwrite] = ...,
|
||||||
category: Optional[Snowflake] = ...,
|
category: Optional[Snowflake] = ...,
|
||||||
**options: Any,
|
**options: Any,
|
||||||
) -> Coroutine[Any, Any, TextChannelPayload]:
|
) -> Coroutine[Any, Any, TextChannelPayload]:
|
||||||
@ -1074,7 +1076,7 @@ class Guild(Hashable):
|
|||||||
self,
|
self,
|
||||||
name: str,
|
name: str,
|
||||||
channel_type: Literal[ChannelType.voice],
|
channel_type: Literal[ChannelType.voice],
|
||||||
overwrites: Dict[Union[Role, Member], PermissionOverwrite] = ...,
|
overwrites: Mapping[Union[Role, Member], PermissionOverwrite] = ...,
|
||||||
category: Optional[Snowflake] = ...,
|
category: Optional[Snowflake] = ...,
|
||||||
**options: Any,
|
**options: Any,
|
||||||
) -> Coroutine[Any, Any, VoiceChannelPayload]:
|
) -> Coroutine[Any, Any, VoiceChannelPayload]:
|
||||||
@ -1085,7 +1087,7 @@ class Guild(Hashable):
|
|||||||
self,
|
self,
|
||||||
name: str,
|
name: str,
|
||||||
channel_type: Literal[ChannelType.stage_voice],
|
channel_type: Literal[ChannelType.stage_voice],
|
||||||
overwrites: Dict[Union[Role, Member], PermissionOverwrite] = ...,
|
overwrites: Mapping[Union[Role, Member], PermissionOverwrite] = ...,
|
||||||
category: Optional[Snowflake] = ...,
|
category: Optional[Snowflake] = ...,
|
||||||
**options: Any,
|
**options: Any,
|
||||||
) -> Coroutine[Any, Any, StageChannelPayload]:
|
) -> Coroutine[Any, Any, StageChannelPayload]:
|
||||||
@ -1096,7 +1098,7 @@ class Guild(Hashable):
|
|||||||
self,
|
self,
|
||||||
name: str,
|
name: str,
|
||||||
channel_type: Literal[ChannelType.category],
|
channel_type: Literal[ChannelType.category],
|
||||||
overwrites: Dict[Union[Role, Member], PermissionOverwrite] = ...,
|
overwrites: Mapping[Union[Role, Member], PermissionOverwrite] = ...,
|
||||||
category: Optional[Snowflake] = ...,
|
category: Optional[Snowflake] = ...,
|
||||||
**options: Any,
|
**options: Any,
|
||||||
) -> Coroutine[Any, Any, CategoryChannelPayload]:
|
) -> Coroutine[Any, Any, CategoryChannelPayload]:
|
||||||
@ -1107,7 +1109,7 @@ class Guild(Hashable):
|
|||||||
self,
|
self,
|
||||||
name: str,
|
name: str,
|
||||||
channel_type: Literal[ChannelType.news],
|
channel_type: Literal[ChannelType.news],
|
||||||
overwrites: Dict[Union[Role, Member], PermissionOverwrite] = ...,
|
overwrites: Mapping[Union[Role, Member], PermissionOverwrite] = ...,
|
||||||
category: Optional[Snowflake] = ...,
|
category: Optional[Snowflake] = ...,
|
||||||
**options: Any,
|
**options: Any,
|
||||||
) -> Coroutine[Any, Any, NewsChannelPayload]:
|
) -> Coroutine[Any, Any, NewsChannelPayload]:
|
||||||
@ -1118,7 +1120,7 @@ class Guild(Hashable):
|
|||||||
self,
|
self,
|
||||||
name: str,
|
name: str,
|
||||||
channel_type: Literal[ChannelType.store],
|
channel_type: Literal[ChannelType.store],
|
||||||
overwrites: Dict[Union[Role, Member], PermissionOverwrite] = ...,
|
overwrites: Mapping[Union[Role, Member], PermissionOverwrite] = ...,
|
||||||
category: Optional[Snowflake] = ...,
|
category: Optional[Snowflake] = ...,
|
||||||
**options: Any,
|
**options: Any,
|
||||||
) -> Coroutine[Any, Any, StoreChannelPayload]:
|
) -> Coroutine[Any, Any, StoreChannelPayload]:
|
||||||
@ -1129,7 +1131,7 @@ class Guild(Hashable):
|
|||||||
self,
|
self,
|
||||||
name: str,
|
name: str,
|
||||||
channel_type: Literal[ChannelType.text],
|
channel_type: Literal[ChannelType.text],
|
||||||
overwrites: Dict[Union[Role, Member], PermissionOverwrite] = ...,
|
overwrites: Mapping[Union[Role, Member], PermissionOverwrite] = ...,
|
||||||
category: Optional[Snowflake] = ...,
|
category: Optional[Snowflake] = ...,
|
||||||
**options: Any,
|
**options: Any,
|
||||||
) -> Coroutine[Any, Any, GuildChannelPayload]:
|
) -> Coroutine[Any, Any, GuildChannelPayload]:
|
||||||
@ -1140,7 +1142,7 @@ class Guild(Hashable):
|
|||||||
self,
|
self,
|
||||||
name: str,
|
name: str,
|
||||||
channel_type: ChannelType,
|
channel_type: ChannelType,
|
||||||
overwrites: Dict[Union[Role, Member], PermissionOverwrite] = ...,
|
overwrites: Mapping[Union[Role, Member], PermissionOverwrite] = ...,
|
||||||
category: Optional[Snowflake] = ...,
|
category: Optional[Snowflake] = ...,
|
||||||
**options: Any,
|
**options: Any,
|
||||||
) -> Coroutine[Any, Any, GuildChannelPayload]:
|
) -> Coroutine[Any, Any, GuildChannelPayload]:
|
||||||
@ -1150,13 +1152,13 @@ class Guild(Hashable):
|
|||||||
self,
|
self,
|
||||||
name: str,
|
name: str,
|
||||||
channel_type: ChannelType,
|
channel_type: ChannelType,
|
||||||
overwrites: Dict[Union[Role, Member], PermissionOverwrite] = MISSING,
|
overwrites: Mapping[Union[Role, Member], PermissionOverwrite] = MISSING,
|
||||||
category: Optional[Snowflake] = None,
|
category: Optional[Snowflake] = None,
|
||||||
**options: Any,
|
**options: Any,
|
||||||
) -> Coroutine[Any, Any, GuildChannelPayload]:
|
) -> Coroutine[Any, Any, GuildChannelPayload]:
|
||||||
if overwrites is MISSING:
|
if overwrites is MISSING:
|
||||||
overwrites = {}
|
overwrites = {}
|
||||||
elif not isinstance(overwrites, dict):
|
elif not isinstance(overwrites, Mapping):
|
||||||
raise TypeError('overwrites parameter expects a dict.')
|
raise TypeError('overwrites parameter expects a dict.')
|
||||||
|
|
||||||
perms = []
|
perms = []
|
||||||
@ -1189,7 +1191,7 @@ class Guild(Hashable):
|
|||||||
topic: str = MISSING,
|
topic: str = MISSING,
|
||||||
slowmode_delay: int = MISSING,
|
slowmode_delay: int = MISSING,
|
||||||
nsfw: bool = MISSING,
|
nsfw: bool = MISSING,
|
||||||
overwrites: Dict[Union[Role, Member], PermissionOverwrite] = MISSING,
|
overwrites: Mapping[Union[Role, Member], PermissionOverwrite] = MISSING,
|
||||||
) -> TextChannel:
|
) -> TextChannel:
|
||||||
"""|coro|
|
"""|coro|
|
||||||
|
|
||||||
@ -1306,7 +1308,7 @@ class Guild(Hashable):
|
|||||||
user_limit: int = MISSING,
|
user_limit: int = MISSING,
|
||||||
rtc_region: Optional[str] = MISSING,
|
rtc_region: Optional[str] = MISSING,
|
||||||
video_quality_mode: VideoQualityMode = MISSING,
|
video_quality_mode: VideoQualityMode = MISSING,
|
||||||
overwrites: Dict[Union[Role, Member], PermissionOverwrite] = MISSING,
|
overwrites: Mapping[Union[Role, Member], PermissionOverwrite] = MISSING,
|
||||||
) -> VoiceChannel:
|
) -> VoiceChannel:
|
||||||
"""|coro|
|
"""|coro|
|
||||||
|
|
||||||
@ -1392,7 +1394,7 @@ class Guild(Hashable):
|
|||||||
*,
|
*,
|
||||||
topic: str,
|
topic: str,
|
||||||
position: int = MISSING,
|
position: int = MISSING,
|
||||||
overwrites: Dict[Union[Role, Member], PermissionOverwrite] = MISSING,
|
overwrites: Mapping[Union[Role, Member], PermissionOverwrite] = MISSING,
|
||||||
category: Optional[CategoryChannel] = None,
|
category: Optional[CategoryChannel] = None,
|
||||||
reason: Optional[str] = None,
|
reason: Optional[str] = None,
|
||||||
) -> StageChannel:
|
) -> StageChannel:
|
||||||
@ -1460,7 +1462,7 @@ class Guild(Hashable):
|
|||||||
self,
|
self,
|
||||||
name: str,
|
name: str,
|
||||||
*,
|
*,
|
||||||
overwrites: Dict[Union[Role, Member], PermissionOverwrite] = MISSING,
|
overwrites: Mapping[Union[Role, Member], PermissionOverwrite] = MISSING,
|
||||||
reason: Optional[str] = None,
|
reason: Optional[str] = None,
|
||||||
position: int = MISSING,
|
position: int = MISSING,
|
||||||
) -> CategoryChannel:
|
) -> CategoryChannel:
|
||||||
@ -2067,7 +2069,7 @@ class Guild(Hashable):
|
|||||||
*,
|
*,
|
||||||
days: int,
|
days: int,
|
||||||
compute_prune_count: bool = True,
|
compute_prune_count: bool = True,
|
||||||
roles: List[Snowflake] = MISSING,
|
roles: Collection[Snowflake] = MISSING,
|
||||||
reason: Optional[str] = None,
|
reason: Optional[str] = None,
|
||||||
) -> Optional[int]:
|
) -> Optional[int]:
|
||||||
r"""|coro|
|
r"""|coro|
|
||||||
@ -2183,7 +2185,7 @@ class Guild(Hashable):
|
|||||||
data = await self._state.http.guild_webhooks(self.id)
|
data = await self._state.http.guild_webhooks(self.id)
|
||||||
return [Webhook.from_state(d, state=self._state) for d in data]
|
return [Webhook.from_state(d, state=self._state) for d in data]
|
||||||
|
|
||||||
async def estimate_pruned_members(self, *, days: int, roles: List[Snowflake] = MISSING) -> Optional[int]:
|
async def estimate_pruned_members(self, *, days: int, roles: Collection[Snowflake] = MISSING) -> Optional[int]:
|
||||||
"""|coro|
|
"""|coro|
|
||||||
|
|
||||||
Similar to :meth:`prune_members` except instead of actually
|
Similar to :meth:`prune_members` except instead of actually
|
||||||
@ -2736,7 +2738,7 @@ class Guild(Hashable):
|
|||||||
*,
|
*,
|
||||||
name: str,
|
name: str,
|
||||||
image: bytes,
|
image: bytes,
|
||||||
roles: List[Role] = MISSING,
|
roles: Collection[Role] = MISSING,
|
||||||
reason: Optional[str] = None,
|
reason: Optional[str] = None,
|
||||||
) -> Emoji:
|
) -> Emoji:
|
||||||
r"""|coro|
|
r"""|coro|
|
||||||
@ -2965,7 +2967,7 @@ class Guild(Hashable):
|
|||||||
# TODO: add to cache
|
# TODO: add to cache
|
||||||
return role
|
return role
|
||||||
|
|
||||||
async def edit_role_positions(self, positions: Dict[Snowflake, int], *, reason: Optional[str] = None) -> List[Role]:
|
async def edit_role_positions(self, positions: Mapping[Snowflake, int], *, reason: Optional[str] = None) -> List[Role]:
|
||||||
"""|coro|
|
"""|coro|
|
||||||
|
|
||||||
Bulk edits a list of :class:`Role` in the guild.
|
Bulk edits a list of :class:`Role` in the guild.
|
||||||
@ -3014,7 +3016,7 @@ class Guild(Hashable):
|
|||||||
List[:class:`Role`]
|
List[:class:`Role`]
|
||||||
A list of all the roles in the guild.
|
A list of all the roles in the guild.
|
||||||
"""
|
"""
|
||||||
if not isinstance(positions, dict):
|
if not isinstance(positions, Mapping):
|
||||||
raise TypeError('positions parameter expects a dict.')
|
raise TypeError('positions parameter expects a dict.')
|
||||||
|
|
||||||
role_positions = []
|
role_positions = []
|
||||||
|
@ -116,7 +116,7 @@ async def json_or_text(response: aiohttp.ClientResponse) -> Union[Dict[str, Any]
|
|||||||
class MultipartParameters(NamedTuple):
|
class MultipartParameters(NamedTuple):
|
||||||
payload: Optional[Dict[str, Any]]
|
payload: Optional[Dict[str, Any]]
|
||||||
multipart: Optional[List[Dict[str, Any]]]
|
multipart: Optional[List[Dict[str, Any]]]
|
||||||
files: Optional[List[File]]
|
files: Optional[Sequence[File]]
|
||||||
|
|
||||||
def __enter__(self) -> Self:
|
def __enter__(self) -> Self:
|
||||||
return self
|
return self
|
||||||
@ -141,10 +141,10 @@ def handle_message_parameters(
|
|||||||
nonce: Optional[Union[int, str]] = None,
|
nonce: Optional[Union[int, str]] = None,
|
||||||
flags: MessageFlags = MISSING,
|
flags: MessageFlags = MISSING,
|
||||||
file: File = MISSING,
|
file: File = MISSING,
|
||||||
files: List[File] = MISSING,
|
files: Sequence[File] = MISSING,
|
||||||
embed: Optional[Embed] = MISSING,
|
embed: Optional[Embed] = MISSING,
|
||||||
embeds: List[Embed] = MISSING,
|
embeds: Sequence[Embed] = MISSING,
|
||||||
attachments: List[Union[Attachment, File]] = MISSING,
|
attachments: Sequence[Union[Attachment, File]] = MISSING,
|
||||||
view: Optional[View] = MISSING,
|
view: Optional[View] = MISSING,
|
||||||
allowed_mentions: Optional[AllowedMentions] = MISSING,
|
allowed_mentions: Optional[AllowedMentions] = MISSING,
|
||||||
message_reference: Optional[message.MessageReference] = MISSING,
|
message_reference: Optional[message.MessageReference] = MISSING,
|
||||||
@ -225,7 +225,7 @@ def handle_message_parameters(
|
|||||||
}
|
}
|
||||||
|
|
||||||
if attachments is MISSING:
|
if attachments is MISSING:
|
||||||
attachments = files # type: ignore
|
attachments = files
|
||||||
else:
|
else:
|
||||||
files = [a for a in attachments if isinstance(a, File)]
|
files = [a for a in attachments if isinstance(a, File)]
|
||||||
|
|
||||||
@ -1213,7 +1213,7 @@ class HTTPClient:
|
|||||||
guild_id: Snowflake,
|
guild_id: Snowflake,
|
||||||
days: int,
|
days: int,
|
||||||
compute_prune_count: bool,
|
compute_prune_count: bool,
|
||||||
roles: List[str],
|
roles: Iterable[str],
|
||||||
*,
|
*,
|
||||||
reason: Optional[str] = None,
|
reason: Optional[str] = None,
|
||||||
) -> Response[guild.GuildPrune]:
|
) -> Response[guild.GuildPrune]:
|
||||||
@ -1230,7 +1230,7 @@ class HTTPClient:
|
|||||||
self,
|
self,
|
||||||
guild_id: Snowflake,
|
guild_id: Snowflake,
|
||||||
days: int,
|
days: int,
|
||||||
roles: List[str],
|
roles: Iterable[str],
|
||||||
) -> Response[guild.GuildPrune]:
|
) -> Response[guild.GuildPrune]:
|
||||||
params: Dict[str, Any] = {
|
params: Dict[str, Any] = {
|
||||||
'days': days,
|
'days': days,
|
||||||
|
@ -25,7 +25,7 @@ DEALINGS IN THE SOFTWARE.
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
from typing import Any, Dict, List, Optional, TYPE_CHECKING, Tuple, Union
|
from typing import Any, Dict, List, Optional, TYPE_CHECKING, Sequence, Tuple, Union
|
||||||
import asyncio
|
import asyncio
|
||||||
import datetime
|
import datetime
|
||||||
|
|
||||||
@ -304,9 +304,9 @@ class Interaction:
|
|||||||
self,
|
self,
|
||||||
*,
|
*,
|
||||||
content: Optional[str] = MISSING,
|
content: Optional[str] = MISSING,
|
||||||
embeds: List[Embed] = MISSING,
|
embeds: Sequence[Embed] = MISSING,
|
||||||
embed: Optional[Embed] = MISSING,
|
embed: Optional[Embed] = MISSING,
|
||||||
attachments: List[Union[Attachment, File]] = MISSING,
|
attachments: Sequence[Union[Attachment, File]] = MISSING,
|
||||||
view: Optional[View] = MISSING,
|
view: Optional[View] = MISSING,
|
||||||
allowed_mentions: Optional[AllowedMentions] = None,
|
allowed_mentions: Optional[AllowedMentions] = None,
|
||||||
) -> InteractionMessage:
|
) -> InteractionMessage:
|
||||||
@ -526,9 +526,9 @@ class InteractionResponse:
|
|||||||
content: Optional[Any] = None,
|
content: Optional[Any] = None,
|
||||||
*,
|
*,
|
||||||
embed: Embed = MISSING,
|
embed: Embed = MISSING,
|
||||||
embeds: List[Embed] = MISSING,
|
embeds: Sequence[Embed] = MISSING,
|
||||||
file: File = MISSING,
|
file: File = MISSING,
|
||||||
files: List[File] = MISSING,
|
files: Sequence[File] = MISSING,
|
||||||
view: View = MISSING,
|
view: View = MISSING,
|
||||||
tts: bool = False,
|
tts: bool = False,
|
||||||
ephemeral: bool = False,
|
ephemeral: bool = False,
|
||||||
@ -626,8 +626,8 @@ class InteractionResponse:
|
|||||||
*,
|
*,
|
||||||
content: Optional[Any] = MISSING,
|
content: Optional[Any] = MISSING,
|
||||||
embed: Optional[Embed] = MISSING,
|
embed: Optional[Embed] = MISSING,
|
||||||
embeds: List[Embed] = MISSING,
|
embeds: Sequence[Embed] = MISSING,
|
||||||
attachments: List[Union[Attachment, File]] = MISSING,
|
attachments: Sequence[Union[Attachment, File]] = MISSING,
|
||||||
view: Optional[View] = MISSING,
|
view: Optional[View] = MISSING,
|
||||||
allowed_mentions: Optional[AllowedMentions] = MISSING,
|
allowed_mentions: Optional[AllowedMentions] = MISSING,
|
||||||
) -> None:
|
) -> None:
|
||||||
@ -741,7 +741,7 @@ class InteractionResponse:
|
|||||||
self._parent._state.store_view(modal)
|
self._parent._state.store_view(modal)
|
||||||
self._responded = True
|
self._responded = True
|
||||||
|
|
||||||
async def autocomplete(self, choices: List[Choice[ChoiceT]]) -> None:
|
async def autocomplete(self, choices: Sequence[Choice[ChoiceT]]) -> None:
|
||||||
"""|coro|
|
"""|coro|
|
||||||
|
|
||||||
Responds to this interaction by giving the user the choices they can use.
|
Responds to this interaction by giving the user the choices they can use.
|
||||||
@ -825,9 +825,9 @@ class InteractionMessage(Message):
|
|||||||
async def edit(
|
async def edit(
|
||||||
self,
|
self,
|
||||||
content: Optional[str] = MISSING,
|
content: Optional[str] = MISSING,
|
||||||
embeds: List[Embed] = MISSING,
|
embeds: Sequence[Embed] = MISSING,
|
||||||
embed: Optional[Embed] = MISSING,
|
embed: Optional[Embed] = MISSING,
|
||||||
attachments: List[Union[Attachment, File]] = MISSING,
|
attachments: Sequence[Union[Attachment, File]] = MISSING,
|
||||||
view: Optional[View] = MISSING,
|
view: Optional[View] = MISSING,
|
||||||
allowed_mentions: Optional[AllowedMentions] = None,
|
allowed_mentions: Optional[AllowedMentions] = None,
|
||||||
) -> InteractionMessage:
|
) -> InteractionMessage:
|
||||||
|
@ -28,7 +28,7 @@ import datetime
|
|||||||
import inspect
|
import inspect
|
||||||
import itertools
|
import itertools
|
||||||
from operator import attrgetter
|
from operator import attrgetter
|
||||||
from typing import Any, Callable, Coroutine, Dict, List, Literal, Optional, TYPE_CHECKING, Tuple, Union, Type
|
from typing import Any, Callable, Collection, Coroutine, Dict, List, Literal, Optional, TYPE_CHECKING, Tuple, Union, Type
|
||||||
|
|
||||||
import discord.abc
|
import discord.abc
|
||||||
|
|
||||||
@ -720,7 +720,7 @@ class Member(discord.abc.Messageable, _UserTag):
|
|||||||
mute: bool = MISSING,
|
mute: bool = MISSING,
|
||||||
deafen: bool = MISSING,
|
deafen: bool = MISSING,
|
||||||
suppress: bool = MISSING,
|
suppress: bool = MISSING,
|
||||||
roles: List[discord.abc.Snowflake] = MISSING,
|
roles: Collection[discord.abc.Snowflake] = MISSING,
|
||||||
voice_channel: Optional[VocalGuildChannel] = MISSING,
|
voice_channel: Optional[VocalGuildChannel] = MISSING,
|
||||||
timed_out_until: Optional[datetime.datetime] = MISSING,
|
timed_out_until: Optional[datetime.datetime] = MISSING,
|
||||||
reason: Optional[str] = None,
|
reason: Optional[str] = None,
|
||||||
|
@ -32,6 +32,7 @@ from os import PathLike
|
|||||||
from typing import (
|
from typing import (
|
||||||
Dict,
|
Dict,
|
||||||
TYPE_CHECKING,
|
TYPE_CHECKING,
|
||||||
|
Sequence,
|
||||||
Union,
|
Union,
|
||||||
List,
|
List,
|
||||||
Optional,
|
Optional,
|
||||||
@ -1195,7 +1196,7 @@ class Message(Hashable):
|
|||||||
*,
|
*,
|
||||||
content: Optional[str] = ...,
|
content: Optional[str] = ...,
|
||||||
embed: Optional[Embed] = ...,
|
embed: Optional[Embed] = ...,
|
||||||
attachments: List[Union[Attachment, File]] = ...,
|
attachments: Sequence[Union[Attachment, File]] = ...,
|
||||||
suppress: bool = ...,
|
suppress: bool = ...,
|
||||||
delete_after: Optional[float] = ...,
|
delete_after: Optional[float] = ...,
|
||||||
allowed_mentions: Optional[AllowedMentions] = ...,
|
allowed_mentions: Optional[AllowedMentions] = ...,
|
||||||
@ -1208,8 +1209,8 @@ class Message(Hashable):
|
|||||||
self,
|
self,
|
||||||
*,
|
*,
|
||||||
content: Optional[str] = ...,
|
content: Optional[str] = ...,
|
||||||
embeds: List[Embed] = ...,
|
embeds: Sequence[Embed] = ...,
|
||||||
attachments: List[Union[Attachment, File]] = ...,
|
attachments: Sequence[Union[Attachment, File]] = ...,
|
||||||
suppress: bool = ...,
|
suppress: bool = ...,
|
||||||
delete_after: Optional[float] = ...,
|
delete_after: Optional[float] = ...,
|
||||||
allowed_mentions: Optional[AllowedMentions] = ...,
|
allowed_mentions: Optional[AllowedMentions] = ...,
|
||||||
@ -1221,8 +1222,8 @@ class Message(Hashable):
|
|||||||
self,
|
self,
|
||||||
content: Optional[str] = MISSING,
|
content: Optional[str] = MISSING,
|
||||||
embed: Optional[Embed] = MISSING,
|
embed: Optional[Embed] = MISSING,
|
||||||
embeds: List[Embed] = MISSING,
|
embeds: Sequence[Embed] = MISSING,
|
||||||
attachments: List[Union[Attachment, File]] = MISSING,
|
attachments: Sequence[Union[Attachment, File]] = MISSING,
|
||||||
suppress: bool = MISSING,
|
suppress: bool = MISSING,
|
||||||
delete_after: Optional[float] = None,
|
delete_after: Optional[float] = None,
|
||||||
allowed_mentions: Optional[AllowedMentions] = MISSING,
|
allowed_mentions: Optional[AllowedMentions] = MISSING,
|
||||||
|
@ -30,7 +30,7 @@ import json
|
|||||||
import re
|
import re
|
||||||
|
|
||||||
from urllib.parse import quote as urlquote
|
from urllib.parse import quote as urlquote
|
||||||
from typing import Any, Dict, List, Literal, Optional, TYPE_CHECKING, Tuple, Union, TypeVar, Type, overload
|
from typing import Any, Dict, List, Literal, Optional, TYPE_CHECKING, Sequence, Tuple, Union, TypeVar, Type, overload
|
||||||
from contextvars import ContextVar
|
from contextvars import ContextVar
|
||||||
import weakref
|
import weakref
|
||||||
|
|
||||||
@ -126,7 +126,7 @@ class AsyncWebhookAdapter:
|
|||||||
*,
|
*,
|
||||||
payload: Optional[Dict[str, Any]] = None,
|
payload: Optional[Dict[str, Any]] = None,
|
||||||
multipart: Optional[List[Dict[str, Any]]] = None,
|
multipart: Optional[List[Dict[str, Any]]] = None,
|
||||||
files: Optional[List[File]] = None,
|
files: Optional[Sequence[File]] = None,
|
||||||
reason: Optional[str] = None,
|
reason: Optional[str] = None,
|
||||||
auth_token: Optional[str] = None,
|
auth_token: Optional[str] = None,
|
||||||
params: Optional[Dict[str, Any]] = None,
|
params: Optional[Dict[str, Any]] = None,
|
||||||
@ -279,7 +279,7 @@ class AsyncWebhookAdapter:
|
|||||||
session: aiohttp.ClientSession,
|
session: aiohttp.ClientSession,
|
||||||
payload: Optional[Dict[str, Any]] = None,
|
payload: Optional[Dict[str, Any]] = None,
|
||||||
multipart: Optional[List[Dict[str, Any]]] = None,
|
multipart: Optional[List[Dict[str, Any]]] = None,
|
||||||
files: Optional[List[File]] = None,
|
files: Optional[Sequence[File]] = None,
|
||||||
thread_id: Optional[int] = None,
|
thread_id: Optional[int] = None,
|
||||||
wait: bool = False,
|
wait: bool = False,
|
||||||
) -> Response[Optional[MessagePayload]]:
|
) -> Response[Optional[MessagePayload]]:
|
||||||
@ -315,7 +315,7 @@ class AsyncWebhookAdapter:
|
|||||||
session: aiohttp.ClientSession,
|
session: aiohttp.ClientSession,
|
||||||
payload: Optional[Dict[str, Any]] = None,
|
payload: Optional[Dict[str, Any]] = None,
|
||||||
multipart: Optional[List[Dict[str, Any]]] = None,
|
multipart: Optional[List[Dict[str, Any]]] = None,
|
||||||
files: Optional[List[File]] = None,
|
files: Optional[Sequence[File]] = None,
|
||||||
) -> Response[Message]:
|
) -> Response[Message]:
|
||||||
route = Route(
|
route = Route(
|
||||||
'PATCH',
|
'PATCH',
|
||||||
@ -450,10 +450,10 @@ def interaction_message_response_params(
|
|||||||
tts: bool = False,
|
tts: bool = False,
|
||||||
flags: MessageFlags = MISSING,
|
flags: MessageFlags = MISSING,
|
||||||
file: File = MISSING,
|
file: File = MISSING,
|
||||||
files: List[File] = MISSING,
|
files: Sequence[File] = MISSING,
|
||||||
embed: Optional[Embed] = MISSING,
|
embed: Optional[Embed] = MISSING,
|
||||||
embeds: List[Embed] = MISSING,
|
embeds: Sequence[Embed] = MISSING,
|
||||||
attachments: List[Union[Attachment, File]] = MISSING,
|
attachments: Sequence[Union[Attachment, File]] = MISSING,
|
||||||
view: Optional[View] = MISSING,
|
view: Optional[View] = MISSING,
|
||||||
allowed_mentions: Optional[AllowedMentions] = MISSING,
|
allowed_mentions: Optional[AllowedMentions] = MISSING,
|
||||||
previous_allowed_mentions: Optional[AllowedMentions] = None,
|
previous_allowed_mentions: Optional[AllowedMentions] = None,
|
||||||
@ -508,7 +508,7 @@ def interaction_message_response_params(
|
|||||||
data['allowed_mentions'] = previous_allowed_mentions.to_dict()
|
data['allowed_mentions'] = previous_allowed_mentions.to_dict()
|
||||||
|
|
||||||
if attachments is MISSING:
|
if attachments is MISSING:
|
||||||
attachments = files # type: ignore
|
attachments = files
|
||||||
else:
|
else:
|
||||||
files = [a for a in attachments if isinstance(a, File)]
|
files = [a for a in attachments if isinstance(a, File)]
|
||||||
|
|
||||||
@ -673,9 +673,9 @@ class WebhookMessage(Message):
|
|||||||
async def edit(
|
async def edit(
|
||||||
self,
|
self,
|
||||||
content: Optional[str] = MISSING,
|
content: Optional[str] = MISSING,
|
||||||
embeds: List[Embed] = MISSING,
|
embeds: Sequence[Embed] = MISSING,
|
||||||
embed: Optional[Embed] = MISSING,
|
embed: Optional[Embed] = MISSING,
|
||||||
attachments: List[Union[Attachment, File]] = MISSING,
|
attachments: Sequence[Union[Attachment, File]] = MISSING,
|
||||||
view: Optional[View] = MISSING,
|
view: Optional[View] = MISSING,
|
||||||
allowed_mentions: Optional[AllowedMentions] = None,
|
allowed_mentions: Optional[AllowedMentions] = None,
|
||||||
) -> WebhookMessage:
|
) -> WebhookMessage:
|
||||||
@ -1333,9 +1333,9 @@ class Webhook(BaseWebhook):
|
|||||||
tts: bool = MISSING,
|
tts: bool = MISSING,
|
||||||
ephemeral: bool = MISSING,
|
ephemeral: bool = MISSING,
|
||||||
file: File = MISSING,
|
file: File = MISSING,
|
||||||
files: List[File] = MISSING,
|
files: Sequence[File] = MISSING,
|
||||||
embed: Embed = MISSING,
|
embed: Embed = MISSING,
|
||||||
embeds: List[Embed] = MISSING,
|
embeds: Sequence[Embed] = MISSING,
|
||||||
allowed_mentions: AllowedMentions = MISSING,
|
allowed_mentions: AllowedMentions = MISSING,
|
||||||
view: View = MISSING,
|
view: View = MISSING,
|
||||||
thread: Snowflake = MISSING,
|
thread: Snowflake = MISSING,
|
||||||
@ -1354,9 +1354,9 @@ class Webhook(BaseWebhook):
|
|||||||
tts: bool = MISSING,
|
tts: bool = MISSING,
|
||||||
ephemeral: bool = MISSING,
|
ephemeral: bool = MISSING,
|
||||||
file: File = MISSING,
|
file: File = MISSING,
|
||||||
files: List[File] = MISSING,
|
files: Sequence[File] = MISSING,
|
||||||
embed: Embed = MISSING,
|
embed: Embed = MISSING,
|
||||||
embeds: List[Embed] = MISSING,
|
embeds: Sequence[Embed] = MISSING,
|
||||||
allowed_mentions: AllowedMentions = MISSING,
|
allowed_mentions: AllowedMentions = MISSING,
|
||||||
view: View = MISSING,
|
view: View = MISSING,
|
||||||
thread: Snowflake = MISSING,
|
thread: Snowflake = MISSING,
|
||||||
@ -1374,9 +1374,9 @@ class Webhook(BaseWebhook):
|
|||||||
tts: bool = False,
|
tts: bool = False,
|
||||||
ephemeral: bool = False,
|
ephemeral: bool = False,
|
||||||
file: File = MISSING,
|
file: File = MISSING,
|
||||||
files: List[File] = MISSING,
|
files: Sequence[File] = MISSING,
|
||||||
embed: Embed = MISSING,
|
embed: Embed = MISSING,
|
||||||
embeds: List[Embed] = MISSING,
|
embeds: Sequence[Embed] = MISSING,
|
||||||
allowed_mentions: AllowedMentions = MISSING,
|
allowed_mentions: AllowedMentions = MISSING,
|
||||||
view: View = MISSING,
|
view: View = MISSING,
|
||||||
thread: Snowflake = MISSING,
|
thread: Snowflake = MISSING,
|
||||||
@ -1594,9 +1594,9 @@ class Webhook(BaseWebhook):
|
|||||||
message_id: int,
|
message_id: int,
|
||||||
*,
|
*,
|
||||||
content: Optional[str] = MISSING,
|
content: Optional[str] = MISSING,
|
||||||
embeds: List[Embed] = MISSING,
|
embeds: Sequence[Embed] = MISSING,
|
||||||
embed: Optional[Embed] = MISSING,
|
embed: Optional[Embed] = MISSING,
|
||||||
attachments: List[Union[Attachment, File]] = MISSING,
|
attachments: Sequence[Union[Attachment, File]] = MISSING,
|
||||||
view: Optional[View] = MISSING,
|
view: Optional[View] = MISSING,
|
||||||
allowed_mentions: Optional[AllowedMentions] = None,
|
allowed_mentions: Optional[AllowedMentions] = None,
|
||||||
) -> WebhookMessage:
|
) -> WebhookMessage:
|
||||||
|
@ -37,7 +37,7 @@ import time
|
|||||||
import re
|
import re
|
||||||
|
|
||||||
from urllib.parse import quote as urlquote
|
from urllib.parse import quote as urlquote
|
||||||
from typing import Any, Dict, List, Literal, Optional, TYPE_CHECKING, Tuple, Union, TypeVar, Type, overload
|
from typing import Any, Dict, List, Literal, Optional, TYPE_CHECKING, Sequence, Tuple, Union, TypeVar, Type, overload
|
||||||
import weakref
|
import weakref
|
||||||
|
|
||||||
from .. import utils
|
from .. import utils
|
||||||
@ -116,7 +116,7 @@ class WebhookAdapter:
|
|||||||
*,
|
*,
|
||||||
payload: Optional[Dict[str, Any]] = None,
|
payload: Optional[Dict[str, Any]] = None,
|
||||||
multipart: Optional[List[Dict[str, Any]]] = None,
|
multipart: Optional[List[Dict[str, Any]]] = None,
|
||||||
files: Optional[List[File]] = None,
|
files: Optional[Sequence[File]] = None,
|
||||||
reason: Optional[str] = None,
|
reason: Optional[str] = None,
|
||||||
auth_token: Optional[str] = None,
|
auth_token: Optional[str] = None,
|
||||||
params: Optional[Dict[str, Any]] = None,
|
params: Optional[Dict[str, Any]] = None,
|
||||||
@ -279,7 +279,7 @@ class WebhookAdapter:
|
|||||||
session: Session,
|
session: Session,
|
||||||
payload: Optional[Dict[str, Any]] = None,
|
payload: Optional[Dict[str, Any]] = None,
|
||||||
multipart: Optional[List[Dict[str, Any]]] = None,
|
multipart: Optional[List[Dict[str, Any]]] = None,
|
||||||
files: Optional[List[File]] = None,
|
files: Optional[Sequence[File]] = None,
|
||||||
thread_id: Optional[int] = None,
|
thread_id: Optional[int] = None,
|
||||||
wait: bool = False,
|
wait: bool = False,
|
||||||
) -> MessagePayload:
|
) -> MessagePayload:
|
||||||
@ -315,7 +315,7 @@ class WebhookAdapter:
|
|||||||
session: Session,
|
session: Session,
|
||||||
payload: Optional[Dict[str, Any]] = None,
|
payload: Optional[Dict[str, Any]] = None,
|
||||||
multipart: Optional[List[Dict[str, Any]]] = None,
|
multipart: Optional[List[Dict[str, Any]]] = None,
|
||||||
files: Optional[List[File]] = None,
|
files: Optional[Sequence[File]] = None,
|
||||||
) -> MessagePayload:
|
) -> MessagePayload:
|
||||||
route = Route(
|
route = Route(
|
||||||
'PATCH',
|
'PATCH',
|
||||||
@ -394,9 +394,9 @@ class SyncWebhookMessage(Message):
|
|||||||
def edit(
|
def edit(
|
||||||
self,
|
self,
|
||||||
content: Optional[str] = MISSING,
|
content: Optional[str] = MISSING,
|
||||||
embeds: List[Embed] = MISSING,
|
embeds: Sequence[Embed] = MISSING,
|
||||||
embed: Optional[Embed] = MISSING,
|
embed: Optional[Embed] = MISSING,
|
||||||
attachments: List[Union[Attachment, File]] = MISSING,
|
attachments: Sequence[Union[Attachment, File]] = MISSING,
|
||||||
allowed_mentions: Optional[AllowedMentions] = None,
|
allowed_mentions: Optional[AllowedMentions] = None,
|
||||||
) -> SyncWebhookMessage:
|
) -> SyncWebhookMessage:
|
||||||
"""Edits the message.
|
"""Edits the message.
|
||||||
@ -848,9 +848,9 @@ class SyncWebhook(BaseWebhook):
|
|||||||
avatar_url: Any = MISSING,
|
avatar_url: Any = MISSING,
|
||||||
tts: bool = MISSING,
|
tts: bool = MISSING,
|
||||||
file: File = MISSING,
|
file: File = MISSING,
|
||||||
files: List[File] = MISSING,
|
files: Sequence[File] = MISSING,
|
||||||
embed: Embed = MISSING,
|
embed: Embed = MISSING,
|
||||||
embeds: List[Embed] = MISSING,
|
embeds: Sequence[Embed] = MISSING,
|
||||||
allowed_mentions: AllowedMentions = MISSING,
|
allowed_mentions: AllowedMentions = MISSING,
|
||||||
wait: Literal[True],
|
wait: Literal[True],
|
||||||
suppress_embeds: bool = MISSING,
|
suppress_embeds: bool = MISSING,
|
||||||
@ -866,9 +866,9 @@ class SyncWebhook(BaseWebhook):
|
|||||||
avatar_url: Any = MISSING,
|
avatar_url: Any = MISSING,
|
||||||
tts: bool = MISSING,
|
tts: bool = MISSING,
|
||||||
file: File = MISSING,
|
file: File = MISSING,
|
||||||
files: List[File] = MISSING,
|
files: Sequence[File] = MISSING,
|
||||||
embed: Embed = MISSING,
|
embed: Embed = MISSING,
|
||||||
embeds: List[Embed] = MISSING,
|
embeds: Sequence[Embed] = MISSING,
|
||||||
allowed_mentions: AllowedMentions = MISSING,
|
allowed_mentions: AllowedMentions = MISSING,
|
||||||
wait: Literal[False] = ...,
|
wait: Literal[False] = ...,
|
||||||
suppress_embeds: bool = MISSING,
|
suppress_embeds: bool = MISSING,
|
||||||
@ -883,9 +883,9 @@ class SyncWebhook(BaseWebhook):
|
|||||||
avatar_url: Any = MISSING,
|
avatar_url: Any = MISSING,
|
||||||
tts: bool = False,
|
tts: bool = False,
|
||||||
file: File = MISSING,
|
file: File = MISSING,
|
||||||
files: List[File] = MISSING,
|
files: Sequence[File] = MISSING,
|
||||||
embed: Embed = MISSING,
|
embed: Embed = MISSING,
|
||||||
embeds: List[Embed] = MISSING,
|
embeds: Sequence[Embed] = MISSING,
|
||||||
allowed_mentions: AllowedMentions = MISSING,
|
allowed_mentions: AllowedMentions = MISSING,
|
||||||
thread: Snowflake = MISSING,
|
thread: Snowflake = MISSING,
|
||||||
wait: bool = False,
|
wait: bool = False,
|
||||||
@ -1050,9 +1050,9 @@ class SyncWebhook(BaseWebhook):
|
|||||||
message_id: int,
|
message_id: int,
|
||||||
*,
|
*,
|
||||||
content: Optional[str] = MISSING,
|
content: Optional[str] = MISSING,
|
||||||
embeds: List[Embed] = MISSING,
|
embeds: Sequence[Embed] = MISSING,
|
||||||
embed: Optional[Embed] = MISSING,
|
embed: Optional[Embed] = MISSING,
|
||||||
attachments: List[Union[Attachment, File]] = MISSING,
|
attachments: Sequence[Union[Attachment, File]] = MISSING,
|
||||||
allowed_mentions: Optional[AllowedMentions] = None,
|
allowed_mentions: Optional[AllowedMentions] = None,
|
||||||
) -> SyncWebhookMessage:
|
) -> SyncWebhookMessage:
|
||||||
"""Edits a message owned by this webhook.
|
"""Edits a message owned by this webhook.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user