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