mirror of
https://github.com/Rapptz/discord.py.git
synced 2025-04-18 23:15:48 +00:00
[types] Use PEP-655 style Required/NotRequired types
This commit is contained in:
parent
b1878224f2
commit
d600436378
@ -1306,7 +1306,7 @@ class HTTPClient:
|
||||
self,
|
||||
guild_id: Snowflake,
|
||||
sticker_id: Snowflake,
|
||||
payload: sticker.EditGuildSticker,
|
||||
payload: Dict[str, Any],
|
||||
reason: Optional[str],
|
||||
) -> Response[sticker.GuildSticker]:
|
||||
return self.request(
|
||||
|
@ -52,7 +52,6 @@ if TYPE_CHECKING:
|
||||
StandardSticker as StandardStickerPayload,
|
||||
GuildSticker as GuildStickerPayload,
|
||||
ListPremiumStickerPacks as ListPremiumStickerPacksPayload,
|
||||
EditGuildSticker,
|
||||
)
|
||||
|
||||
|
||||
@ -469,7 +468,7 @@ class GuildSticker(Sticker):
|
||||
:class:`GuildSticker`
|
||||
The newly modified sticker.
|
||||
"""
|
||||
payload: EditGuildSticker = {}
|
||||
payload = {}
|
||||
|
||||
if name is not MISSING:
|
||||
payload['name'] = name
|
||||
|
@ -25,6 +25,7 @@ DEALINGS IN THE SOFTWARE.
|
||||
from __future__ import annotations
|
||||
|
||||
from typing import List, Literal, Optional, TypedDict
|
||||
from typing_extensions import NotRequired
|
||||
from .user import User
|
||||
from .snowflake import Snowflake
|
||||
|
||||
@ -69,13 +70,10 @@ class ActivitySecrets(TypedDict, total=False):
|
||||
match: str
|
||||
|
||||
|
||||
class _ActivityEmojiOptional(TypedDict, total=False):
|
||||
id: Snowflake
|
||||
animated: bool
|
||||
|
||||
|
||||
class ActivityEmoji(_ActivityEmojiOptional):
|
||||
class ActivityEmoji(TypedDict):
|
||||
name: str
|
||||
id: NotRequired[Snowflake]
|
||||
animated: NotRequired[bool]
|
||||
|
||||
|
||||
class ActivityButton(TypedDict):
|
||||
@ -83,16 +81,13 @@ class ActivityButton(TypedDict):
|
||||
url: str
|
||||
|
||||
|
||||
class _SendableActivityOptional(TypedDict, total=False):
|
||||
url: Optional[str]
|
||||
|
||||
|
||||
ActivityType = Literal[0, 1, 2, 4, 5]
|
||||
|
||||
|
||||
class SendableActivity(_SendableActivityOptional):
|
||||
class SendableActivity(TypedDict):
|
||||
name: str
|
||||
type: ActivityType
|
||||
url: NotRequired[Optional[str]]
|
||||
|
||||
|
||||
class _BaseActivity(SendableActivity):
|
||||
|
@ -25,6 +25,7 @@ DEALINGS IN THE SOFTWARE.
|
||||
from __future__ import annotations
|
||||
|
||||
from typing import TypedDict, List, Optional
|
||||
from typing_extensions import NotRequired
|
||||
|
||||
from .user import User
|
||||
from .team import Team
|
||||
@ -40,25 +41,22 @@ class BaseAppInfo(TypedDict):
|
||||
description: str
|
||||
|
||||
|
||||
class _AppInfoOptional(TypedDict, total=False):
|
||||
team: Team
|
||||
guild_id: Snowflake
|
||||
primary_sku_id: Snowflake
|
||||
slug: str
|
||||
terms_of_service_url: str
|
||||
privacy_policy_url: str
|
||||
hook: bool
|
||||
max_participants: int
|
||||
|
||||
|
||||
class AppInfo(BaseAppInfo, _AppInfoOptional):
|
||||
class AppInfo(BaseAppInfo):
|
||||
rpc_origins: List[str]
|
||||
owner: User
|
||||
bot_public: bool
|
||||
bot_require_code_grant: bool
|
||||
team: NotRequired[Team]
|
||||
guild_id: NotRequired[Snowflake]
|
||||
primary_sku_id: NotRequired[Snowflake]
|
||||
slug: NotRequired[str]
|
||||
terms_of_service_url: NotRequired[str]
|
||||
privacy_policy_url: NotRequired[str]
|
||||
hook: NotRequired[bool]
|
||||
max_participants: NotRequired[int]
|
||||
|
||||
|
||||
class _PartialAppInfoOptional(TypedDict, total=False):
|
||||
class PartialAppInfo(BaseAppInfo, total=False):
|
||||
rpc_origins: List[str]
|
||||
cover_image: str
|
||||
hook: bool
|
||||
@ -68,10 +66,6 @@ class _PartialAppInfoOptional(TypedDict, total=False):
|
||||
flags: int
|
||||
|
||||
|
||||
class PartialAppInfo(_PartialAppInfoOptional, BaseAppInfo):
|
||||
pass
|
||||
|
||||
|
||||
class GatewayAppInfo(TypedDict):
|
||||
id: Snowflake
|
||||
flags: int
|
||||
|
@ -25,6 +25,7 @@ DEALINGS IN THE SOFTWARE.
|
||||
from __future__ import annotations
|
||||
|
||||
from typing import List, Literal, Optional, TypedDict, Union
|
||||
from typing_extensions import NotRequired
|
||||
|
||||
from .webhook import Webhook
|
||||
from .guild import MFALevel, VerificationLevel, ExplicitContentFilterLevel, DefaultMessageNotificationLevel
|
||||
@ -273,17 +274,14 @@ class AuditEntryInfo(TypedDict):
|
||||
role_name: str
|
||||
|
||||
|
||||
class _AuditLogEntryOptional(TypedDict, total=False):
|
||||
changes: List[AuditLogChange]
|
||||
options: AuditEntryInfo
|
||||
reason: str
|
||||
|
||||
|
||||
class AuditLogEntry(_AuditLogEntryOptional):
|
||||
class AuditLogEntry(TypedDict):
|
||||
target_id: Optional[str]
|
||||
user_id: Optional[Snowflake]
|
||||
id: Snowflake
|
||||
action_type: AuditLogEvent
|
||||
changes: NotRequired[List[AuditLogChange]]
|
||||
options: NotRequired[AuditEntryInfo]
|
||||
reason: NotRequired[str]
|
||||
|
||||
|
||||
class AuditLog(TypedDict):
|
||||
|
@ -23,6 +23,8 @@ DEALINGS IN THE SOFTWARE.
|
||||
"""
|
||||
|
||||
from typing import List, Literal, Optional, TypedDict, Union
|
||||
from typing_extensions import NotRequired
|
||||
|
||||
from .user import PartialUser
|
||||
from .snowflake import Snowflake
|
||||
from .threads import ThreadMetadata, ThreadMember, ThreadArchiveDuration, ThreadType
|
||||
@ -59,7 +61,7 @@ class PartialChannel(_BaseChannel):
|
||||
type: ChannelType
|
||||
|
||||
|
||||
class _TextChannelOptional(TypedDict, total=False):
|
||||
class _BaseTextChannel(_BaseGuildChannel, total=False):
|
||||
topic: str
|
||||
last_message_id: Optional[Snowflake]
|
||||
last_pin_timestamp: str
|
||||
@ -67,52 +69,38 @@ class _TextChannelOptional(TypedDict, total=False):
|
||||
default_auto_archive_duration: ThreadArchiveDuration
|
||||
|
||||
|
||||
class TextChannel(_BaseGuildChannel, _TextChannelOptional):
|
||||
class TextChannel(_BaseTextChannel):
|
||||
type: Literal[0]
|
||||
|
||||
|
||||
class NewsChannel(_BaseGuildChannel, _TextChannelOptional):
|
||||
class NewsChannel(_BaseTextChannel):
|
||||
type: Literal[5]
|
||||
|
||||
|
||||
VideoQualityMode = Literal[1, 2]
|
||||
|
||||
|
||||
class _VoiceChannelOptional(TypedDict, total=False):
|
||||
rtc_region: Optional[str]
|
||||
video_quality_mode: VideoQualityMode
|
||||
|
||||
|
||||
class VoiceChannel(_BaseGuildChannel, _VoiceChannelOptional):
|
||||
class VoiceChannel(_BaseTextChannel):
|
||||
type: Literal[2]
|
||||
bitrate: int
|
||||
user_limit: int
|
||||
rtc_region: NotRequired[Optional[str]]
|
||||
video_quality_mode: NotRequired[VideoQualityMode]
|
||||
|
||||
|
||||
class CategoryChannel(_BaseGuildChannel):
|
||||
type: Literal[4]
|
||||
|
||||
|
||||
class _StageChannelOptional(TypedDict, total=False):
|
||||
rtc_region: Optional[str]
|
||||
topic: str
|
||||
|
||||
|
||||
class StageChannel(_BaseGuildChannel, _StageChannelOptional):
|
||||
class StageChannel(_BaseGuildChannel):
|
||||
type: Literal[13]
|
||||
bitrate: int
|
||||
user_limit: int
|
||||
rtc_region: NotRequired[Optional[str]]
|
||||
topic: NotRequired[str]
|
||||
|
||||
|
||||
class _ThreadChannelOptional(TypedDict, total=False):
|
||||
member: ThreadMember
|
||||
owner_id: Snowflake
|
||||
rate_limit_per_user: int
|
||||
last_message_id: Optional[Snowflake]
|
||||
last_pin_timestamp: str
|
||||
|
||||
|
||||
class ThreadChannel(_BaseChannel, _ThreadChannelOptional):
|
||||
class ThreadChannel(_BaseChannel):
|
||||
type: Literal[10, 11, 12]
|
||||
guild_id: Snowflake
|
||||
parent_id: Snowflake
|
||||
@ -123,6 +111,11 @@ class ThreadChannel(_BaseChannel, _ThreadChannelOptional):
|
||||
message_count: int
|
||||
member_count: int
|
||||
thread_metadata: ThreadMetadata
|
||||
member: NotRequired[ThreadMember]
|
||||
owner_id: NotRequired[Snowflake]
|
||||
rate_limit_per_user: NotRequired[int]
|
||||
last_message_id: NotRequired[Optional[Snowflake]]
|
||||
last_pin_timestamp: NotRequired[str]
|
||||
|
||||
|
||||
GuildChannel = Union[TextChannel, NewsChannel, VoiceChannel, CategoryChannel, StageChannel, ThreadChannel]
|
||||
|
@ -25,6 +25,7 @@ DEALINGS IN THE SOFTWARE.
|
||||
from __future__ import annotations
|
||||
|
||||
from typing import List, Literal, TypedDict, Union
|
||||
from typing_extensions import NotRequired, Required
|
||||
|
||||
from .channel import ChannelType
|
||||
from .snowflake import Snowflake
|
||||
@ -57,13 +58,10 @@ class _StringApplicationCommandOptionChoice(TypedDict):
|
||||
value: str
|
||||
|
||||
|
||||
class _StringApplicationCommandOptionOptional(_BaseValueApplicationCommandOption, total=False):
|
||||
choices: List[_StringApplicationCommandOptionChoice]
|
||||
autocomplete: bool
|
||||
|
||||
|
||||
class _StringApplicationCommandOption(_StringApplicationCommandOptionOptional):
|
||||
class _StringApplicationCommandOption(_BaseApplicationCommandOption):
|
||||
type: Literal[3]
|
||||
choices: NotRequired[List[_StringApplicationCommandOptionChoice]]
|
||||
autocomplete: NotRequired[bool]
|
||||
|
||||
|
||||
class _IntegerApplicationCommandOptionChoice(TypedDict):
|
||||
@ -71,27 +69,21 @@ class _IntegerApplicationCommandOptionChoice(TypedDict):
|
||||
value: int
|
||||
|
||||
|
||||
class _IntegerApplicationCommandOptionOptional(_BaseValueApplicationCommandOption, total=False):
|
||||
class _IntegerApplicationCommandOption(_BaseApplicationCommandOption, total=False):
|
||||
type: Required[Literal[4]]
|
||||
min_value: int
|
||||
max_value: int
|
||||
choices: List[_IntegerApplicationCommandOptionChoice]
|
||||
autocomplete: bool
|
||||
|
||||
|
||||
class _IntegerApplicationCommandOption(_IntegerApplicationCommandOptionOptional):
|
||||
type: Literal[4]
|
||||
|
||||
|
||||
class _BooleanApplicationCommandOption(_BaseValueApplicationCommandOption):
|
||||
type: Literal[5]
|
||||
|
||||
|
||||
class _ChannelApplicationCommandOptionChoiceOptional(_BaseApplicationCommandOption, total=False):
|
||||
channel_types: List[ChannelType]
|
||||
|
||||
|
||||
class _ChannelApplicationCommandOptionChoice(_ChannelApplicationCommandOptionChoiceOptional):
|
||||
class _ChannelApplicationCommandOptionChoice(_BaseApplicationCommandOption):
|
||||
type: Literal[7]
|
||||
channel_types: NotRequired[List[ChannelType]]
|
||||
|
||||
|
||||
class _NonChannelSnowflakeApplicationCommandOptionChoice(_BaseValueApplicationCommandOption):
|
||||
@ -109,17 +101,14 @@ class _NumberApplicationCommandOptionChoice(TypedDict):
|
||||
value: float
|
||||
|
||||
|
||||
class _NumberApplicationCommandOptionOptional(_BaseValueApplicationCommandOption, total=False):
|
||||
class _NumberApplicationCommandOption(_BaseValueApplicationCommandOption, total=False):
|
||||
type: Required[Literal[10]]
|
||||
min_value: float
|
||||
max_value: float
|
||||
choices: List[_NumberApplicationCommandOptionChoice]
|
||||
autocomplete: bool
|
||||
|
||||
|
||||
class _NumberApplicationCommandOption(_NumberApplicationCommandOptionOptional):
|
||||
type: Literal[10]
|
||||
|
||||
|
||||
_ValueApplicationCommandOption = Union[
|
||||
_StringApplicationCommandOption,
|
||||
_IntegerApplicationCommandOption,
|
||||
@ -148,7 +137,8 @@ class _BaseApplicationCommand(TypedDict):
|
||||
version: Snowflake
|
||||
|
||||
|
||||
class _ChatInputApplicationCommandOptional(_BaseApplicationCommand, total=False):
|
||||
class _ChatInputApplicationCommand(_BaseApplicationCommand, total=False):
|
||||
description: Required[str]
|
||||
type: Literal[1]
|
||||
options: Union[
|
||||
List[_ValueApplicationCommandOption],
|
||||
@ -156,10 +146,6 @@ class _ChatInputApplicationCommandOptional(_BaseApplicationCommand, total=False)
|
||||
]
|
||||
|
||||
|
||||
class _ChatInputApplicationCommand(_ChatInputApplicationCommandOptional):
|
||||
description: str
|
||||
|
||||
|
||||
class _BaseContextMenuApplicationCommand(_BaseApplicationCommand):
|
||||
description: Literal[""]
|
||||
|
||||
|
@ -25,6 +25,8 @@ DEALINGS IN THE SOFTWARE.
|
||||
from __future__ import annotations
|
||||
|
||||
from typing import List, Literal, TypedDict, Union
|
||||
from typing_extensions import NotRequired
|
||||
|
||||
from .emoji import PartialEmoji
|
||||
|
||||
ComponentType = Literal[1, 2, 3, 4]
|
||||
@ -37,56 +39,44 @@ class ActionRow(TypedDict):
|
||||
components: List[Component]
|
||||
|
||||
|
||||
class _ButtonComponentOptional(TypedDict, total=False):
|
||||
custom_id: str
|
||||
url: str
|
||||
disabled: bool
|
||||
emoji: PartialEmoji
|
||||
label: str
|
||||
|
||||
|
||||
class ButtonComponent(_ButtonComponentOptional):
|
||||
class ButtonComponent(TypedDict):
|
||||
type: Literal[2]
|
||||
style: ButtonStyle
|
||||
custom_id: NotRequired[str]
|
||||
url: NotRequired[str]
|
||||
disabled: NotRequired[bool]
|
||||
emoji: NotRequired[PartialEmoji]
|
||||
label: NotRequired[str]
|
||||
|
||||
|
||||
class _SelectMenuOptional(TypedDict, total=False):
|
||||
placeholder: str
|
||||
min_values: int
|
||||
max_values: int
|
||||
disabled: bool
|
||||
|
||||
|
||||
class _SelectOptionsOptional(TypedDict, total=False):
|
||||
description: str
|
||||
emoji: PartialEmoji
|
||||
|
||||
|
||||
class SelectOption(_SelectOptionsOptional):
|
||||
class SelectOption(TypedDict):
|
||||
label: str
|
||||
value: str
|
||||
default: bool
|
||||
description: NotRequired[str]
|
||||
emoji: NotRequired[PartialEmoji]
|
||||
|
||||
|
||||
class SelectMenu(_SelectMenuOptional):
|
||||
class SelectMenu(TypedDict):
|
||||
type: Literal[3]
|
||||
custom_id: str
|
||||
options: List[SelectOption]
|
||||
placeholder: NotRequired[str]
|
||||
min_values: NotRequired[int]
|
||||
max_values: NotRequired[int]
|
||||
disabled: NotRequired[bool]
|
||||
|
||||
|
||||
class _TextInputOptional(TypedDict, total=False):
|
||||
placeholder: str
|
||||
value: str
|
||||
required: bool
|
||||
min_length: int
|
||||
max_length: int
|
||||
|
||||
|
||||
class TextInput(_TextInputOptional):
|
||||
class TextInput(TypedDict):
|
||||
type: Literal[4]
|
||||
custom_id: str
|
||||
style: TextStyle
|
||||
label: str
|
||||
placeholder: NotRequired[str]
|
||||
value: NotRequired[str]
|
||||
required: NotRequired[bool]
|
||||
min_length: NotRequired[int]
|
||||
max_length: NotRequired[int]
|
||||
|
||||
|
||||
Component = Union[ActionRow, ButtonComponent, SelectMenu, TextInput]
|
||||
|
@ -23,36 +23,28 @@ DEALINGS IN THE SOFTWARE.
|
||||
"""
|
||||
|
||||
from typing import List, Literal, TypedDict
|
||||
from typing_extensions import NotRequired, Required
|
||||
|
||||
|
||||
class _EmbedFooterOptional(TypedDict, total=False):
|
||||
icon_url: str
|
||||
proxy_icon_url: str
|
||||
|
||||
|
||||
class EmbedFooter(_EmbedFooterOptional):
|
||||
class EmbedFooter(TypedDict):
|
||||
text: str
|
||||
icon_url: NotRequired[str]
|
||||
proxy_icon_url: NotRequired[str]
|
||||
|
||||
|
||||
class _EmbedFieldOptional(TypedDict, total=False):
|
||||
inline: bool
|
||||
|
||||
|
||||
class EmbedField(_EmbedFieldOptional):
|
||||
class EmbedField(TypedDict):
|
||||
name: str
|
||||
value: str
|
||||
inline: NotRequired[bool]
|
||||
|
||||
|
||||
class _EmbedThumbnailOptional(TypedDict, total=False):
|
||||
class EmbedThumbnail(TypedDict, total=False):
|
||||
url: Required[str]
|
||||
proxy_url: str
|
||||
height: int
|
||||
width: int
|
||||
|
||||
|
||||
class EmbedThumbnail(_EmbedThumbnailOptional):
|
||||
url: str
|
||||
|
||||
|
||||
class EmbedVideo(TypedDict, total=False):
|
||||
url: str
|
||||
proxy_url: str
|
||||
@ -60,31 +52,25 @@ class EmbedVideo(TypedDict, total=False):
|
||||
width: int
|
||||
|
||||
|
||||
class _EmbedImageOptional(TypedDict, total=False):
|
||||
class EmbedImage(TypedDict, total=False):
|
||||
url: Required[str]
|
||||
proxy_url: str
|
||||
height: int
|
||||
width: int
|
||||
|
||||
|
||||
class EmbedImage(_EmbedImageOptional):
|
||||
url: str
|
||||
|
||||
|
||||
class EmbedProvider(TypedDict, total=False):
|
||||
name: str
|
||||
url: str
|
||||
|
||||
|
||||
class _EmbedAuthorOptional(TypedDict, total=False):
|
||||
class EmbedAuthor(TypedDict, total=False):
|
||||
name: Required[str]
|
||||
url: str
|
||||
icon_url: str
|
||||
proxy_icon_url: str
|
||||
|
||||
|
||||
class EmbedAuthor(_EmbedAuthorOptional):
|
||||
name: str
|
||||
|
||||
|
||||
EmbedType = Literal['rich', 'image', 'video', 'gifv', 'article', 'link']
|
||||
|
||||
|
||||
|
@ -23,7 +23,7 @@ DEALINGS IN THE SOFTWARE.
|
||||
"""
|
||||
|
||||
from typing import List, Literal, Optional, TypedDict
|
||||
|
||||
from typing_extensions import NotRequired, Required
|
||||
|
||||
from .activity import PartialPresenceUpdate
|
||||
from .voice import GuildVoiceState
|
||||
@ -79,68 +79,50 @@ ResumedEvent = Literal[None]
|
||||
MessageCreateEvent = Message
|
||||
|
||||
|
||||
class _MessageDeleteEventOptional(TypedDict, total=False):
|
||||
guild_id: Snowflake
|
||||
|
||||
|
||||
class MessageDeleteEvent(_MessageDeleteEventOptional):
|
||||
class MessageDeleteEvent(TypedDict):
|
||||
id: Snowflake
|
||||
channel_id: Snowflake
|
||||
guild_id: NotRequired[Snowflake]
|
||||
|
||||
|
||||
class _MessageDeleteBulkEventOptional(TypedDict, total=False):
|
||||
guild_id: Snowflake
|
||||
|
||||
|
||||
class MessageDeleteBulkEvent(_MessageDeleteBulkEventOptional):
|
||||
class MessageDeleteBulkEvent(TypedDict):
|
||||
ids: List[Snowflake]
|
||||
channel_id: Snowflake
|
||||
guild_id: NotRequired[Snowflake]
|
||||
|
||||
|
||||
class MessageUpdateEvent(Message):
|
||||
channel_id: Snowflake
|
||||
|
||||
|
||||
class _MessageReactionAddEventOptional(TypedDict, total=False):
|
||||
member: MemberWithUser
|
||||
guild_id: Snowflake
|
||||
|
||||
|
||||
class MessageReactionAddEvent(_MessageReactionAddEventOptional):
|
||||
class MessageReactionAddEvent(TypedDict):
|
||||
user_id: Snowflake
|
||||
channel_id: Snowflake
|
||||
message_id: Snowflake
|
||||
emoji: PartialEmoji
|
||||
member: NotRequired[MemberWithUser]
|
||||
guild_id: NotRequired[Snowflake]
|
||||
|
||||
|
||||
class _MessageReactionRemoveEventOptional(TypedDict, total=False):
|
||||
guild_id: Snowflake
|
||||
|
||||
|
||||
class MessageReactionRemoveEvent(_MessageReactionRemoveEventOptional):
|
||||
class MessageReactionRemoveEvent(TypedDict):
|
||||
user_id: Snowflake
|
||||
channel_id: Snowflake
|
||||
message_id: Snowflake
|
||||
emoji: PartialEmoji
|
||||
guild_id: NotRequired[Snowflake]
|
||||
|
||||
|
||||
class _MessageReactionRemoveAllEventOptional(TypedDict, total=False):
|
||||
guild_id: Snowflake
|
||||
|
||||
|
||||
class MessageReactionRemoveAllEvent(_MessageReactionRemoveAllEventOptional):
|
||||
class MessageReactionRemoveAllEvent(TypedDict):
|
||||
message_id: Snowflake
|
||||
channel_id: Snowflake
|
||||
guild_id: NotRequired[Snowflake]
|
||||
|
||||
|
||||
class _MessageReactionRemoveEmojiEventOptional(TypedDict, total=False):
|
||||
guild_id: Snowflake
|
||||
|
||||
|
||||
class MessageReactionRemoveEmojiEvent(_MessageReactionRemoveEmojiEventOptional):
|
||||
class MessageReactionRemoveEmojiEvent(TypedDict):
|
||||
emoji: PartialEmoji
|
||||
message_id: Snowflake
|
||||
channel_id: Snowflake
|
||||
guild_id: NotRequired[Snowflake]
|
||||
|
||||
|
||||
InteractionCreateEvent = Interaction
|
||||
@ -152,15 +134,7 @@ PresenceUpdateEvent = PartialPresenceUpdate
|
||||
UserUpdateEvent = User
|
||||
|
||||
|
||||
class _InviteCreateEventOptional(TypedDict, total=False):
|
||||
guild_id: Snowflake
|
||||
inviter: User
|
||||
target_type: InviteTargetType
|
||||
target_user: User
|
||||
target_application: PartialAppInfo
|
||||
|
||||
|
||||
class InviteCreateEvent(_InviteCreateEventOptional):
|
||||
class InviteCreateEvent(TypedDict):
|
||||
channel_id: Snowflake
|
||||
code: str
|
||||
created_at: str
|
||||
@ -168,15 +142,17 @@ class InviteCreateEvent(_InviteCreateEventOptional):
|
||||
max_uses: int
|
||||
temporary: bool
|
||||
uses: Literal[0]
|
||||
guild_id: NotRequired[Snowflake]
|
||||
inviter: NotRequired[User]
|
||||
target_type: NotRequired[InviteTargetType]
|
||||
target_user: NotRequired[User]
|
||||
target_application: NotRequired[PartialAppInfo]
|
||||
|
||||
|
||||
class _InviteDeleteEventOptional(TypedDict, total=False):
|
||||
guild_id: Snowflake
|
||||
|
||||
|
||||
class InviteDeleteEvent(_InviteDeleteEventOptional):
|
||||
class InviteDeleteEvent(TypedDict):
|
||||
channel_id: Snowflake
|
||||
code: str
|
||||
guild_id: NotRequired[Snowflake]
|
||||
|
||||
|
||||
class _ChannelEvent(TypedDict):
|
||||
@ -187,24 +163,17 @@ class _ChannelEvent(TypedDict):
|
||||
ChannelCreateEvent = ChannelUpdateEvent = ChannelDeleteEvent = _ChannelEvent
|
||||
|
||||
|
||||
class _ChannelPinsUpdateEventOptional(TypedDict, total=False):
|
||||
guild_id: Snowflake
|
||||
last_pin_timestamp: Optional[str]
|
||||
|
||||
|
||||
class ChannelPinsUpdateEvent(_ChannelPinsUpdateEventOptional):
|
||||
class ChannelPinsUpdateEvent(TypedDict):
|
||||
channel_id: Snowflake
|
||||
guild_id: NotRequired[Snowflake]
|
||||
last_pin_timestamp: NotRequired[Optional[str]]
|
||||
|
||||
|
||||
class _ThreadCreateEventOptional(TypedDict, total=False):
|
||||
class ThreadCreateEvent(Thread, total=False):
|
||||
newly_created: bool
|
||||
members: List[ThreadMember]
|
||||
|
||||
|
||||
class ThreadCreateEvent(Thread, _ThreadCreateEventOptional):
|
||||
...
|
||||
|
||||
|
||||
ThreadUpdateEvent = Thread
|
||||
|
||||
|
||||
@ -215,29 +184,23 @@ class ThreadDeleteEvent(TypedDict):
|
||||
type: ChannelType
|
||||
|
||||
|
||||
class _ThreadListSyncEventOptional(TypedDict, total=False):
|
||||
channel_ids: List[Snowflake]
|
||||
|
||||
|
||||
class ThreadListSyncEvent(_ThreadListSyncEventOptional):
|
||||
class ThreadListSyncEvent(TypedDict):
|
||||
guild_id: Snowflake
|
||||
threads: List[Thread]
|
||||
members: List[ThreadMember]
|
||||
channel_ids: NotRequired[List[Snowflake]]
|
||||
|
||||
|
||||
class ThreadMemberUpdate(ThreadMember):
|
||||
guild_id: Snowflake
|
||||
|
||||
|
||||
class _ThreadMembersUpdateOptional(TypedDict, total=False):
|
||||
added_members: List[ThreadMember]
|
||||
removed_member_ids: List[Snowflake]
|
||||
|
||||
|
||||
class ThreadMembersUpdate(_ThreadMembersUpdateOptional):
|
||||
class ThreadMembersUpdate(TypedDict):
|
||||
id: Snowflake
|
||||
guild_id: Snowflake
|
||||
member_count: int
|
||||
added_members: NotRequired[List[ThreadMember]]
|
||||
removed_member_ids: NotRequired[List[Snowflake]]
|
||||
|
||||
|
||||
class GuildMemberAddEvent(MemberWithUser):
|
||||
@ -249,21 +212,18 @@ class GuildMemberRemoveEvent(TypedDict):
|
||||
user: User
|
||||
|
||||
|
||||
class _GuildMemberUpdateEventOptional(TypedDict, total=False):
|
||||
nick: str
|
||||
premium_since: Optional[str]
|
||||
deaf: bool
|
||||
mute: bool
|
||||
pending: bool
|
||||
communication_disabled_until: str
|
||||
|
||||
|
||||
class GuildMemberUpdateEvent(_GuildMemberUpdateEventOptional):
|
||||
class GuildMemberUpdateEvent(TypedDict):
|
||||
guild_id: Snowflake
|
||||
roles: List[Snowflake]
|
||||
user: User
|
||||
avatar: Optional[str]
|
||||
joined_at: Optional[str]
|
||||
nick: NotRequired[str]
|
||||
premium_since: NotRequired[Optional[str]]
|
||||
deaf: NotRequired[bool]
|
||||
mute: NotRequired[bool]
|
||||
pending: NotRequired[bool]
|
||||
communication_disabled_until: NotRequired[str]
|
||||
|
||||
|
||||
class GuildEmojisUpdateEvent(TypedDict):
|
||||
@ -301,24 +261,22 @@ class GuildRoleDeleteEvent(TypedDict):
|
||||
GuildRoleCreateEvent = GuildRoleUpdateEvent = _GuildRoleEvent
|
||||
|
||||
|
||||
class _GuildMembersChunkEventOptional(TypedDict, total=False):
|
||||
not_found: List[Snowflake]
|
||||
presences: List[PresenceUpdateEvent]
|
||||
nonce: str
|
||||
|
||||
|
||||
class GuildMembersChunkEvent(_GuildMembersChunkEventOptional):
|
||||
class GuildMembersChunkEvent(TypedDict):
|
||||
guild_id: Snowflake
|
||||
members: List[MemberWithUser]
|
||||
chunk_index: int
|
||||
chunk_count: int
|
||||
not_found: NotRequired[List[Snowflake]]
|
||||
presences: NotRequired[List[PresenceUpdateEvent]]
|
||||
nonce: NotRequired[str]
|
||||
|
||||
|
||||
class GuildIntegrationsUpdateEvent(TypedDict):
|
||||
guild_id: Snowflake
|
||||
|
||||
|
||||
class _IntegrationEventOptional(BaseIntegration, total=False):
|
||||
class _IntegrationEvent(BaseIntegration, total=False):
|
||||
guild_id: Required[Snowflake]
|
||||
role_id: Optional[Snowflake]
|
||||
enable_emoticons: bool
|
||||
subscriber_count: int
|
||||
@ -326,20 +284,13 @@ class _IntegrationEventOptional(BaseIntegration, total=False):
|
||||
application: IntegrationApplication
|
||||
|
||||
|
||||
class _IntegrationEvent(_IntegrationEventOptional):
|
||||
guild_id: Snowflake
|
||||
|
||||
|
||||
IntegrationCreateEvent = IntegrationUpdateEvent = _IntegrationEvent
|
||||
|
||||
|
||||
class _IntegrationDeleteEventOptional(TypedDict, total=False):
|
||||
application_id: Snowflake
|
||||
|
||||
|
||||
class IntegrationDeleteEvent(_IntegrationDeleteEventOptional):
|
||||
class IntegrationDeleteEvent(TypedDict):
|
||||
id: Snowflake
|
||||
guild_id: Snowflake
|
||||
application_id: NotRequired[Snowflake]
|
||||
|
||||
|
||||
class WebhooksUpdateEvent(TypedDict):
|
||||
@ -369,12 +320,9 @@ class VoiceServerUpdateEvent(TypedDict):
|
||||
endpoint: Optional[str]
|
||||
|
||||
|
||||
class _TypingStartEventOptional(TypedDict, total=False):
|
||||
guild_id: Snowflake
|
||||
member: MemberWithUser
|
||||
|
||||
|
||||
class TypingStartEvent(_TypingStartEventOptional):
|
||||
class TypingStartEvent(TypedDict):
|
||||
channel_id: Snowflake
|
||||
user_id: Snowflake
|
||||
timestamp: int
|
||||
guild_id: NotRequired[Snowflake]
|
||||
member: NotRequired[MemberWithUser]
|
||||
|
@ -23,6 +23,7 @@ DEALINGS IN THE SOFTWARE.
|
||||
"""
|
||||
|
||||
from typing import List, Literal, Optional, TypedDict
|
||||
from typing_extensions import NotRequired
|
||||
|
||||
from .scheduled_event import GuildScheduledEvent
|
||||
from .sticker import GuildSticker
|
||||
@ -43,32 +44,9 @@ class Ban(TypedDict):
|
||||
user: User
|
||||
|
||||
|
||||
class _UnavailableGuildOptional(TypedDict, total=False):
|
||||
unavailable: bool
|
||||
|
||||
|
||||
class UnavailableGuild(_UnavailableGuildOptional):
|
||||
class UnavailableGuild(TypedDict):
|
||||
id: Snowflake
|
||||
|
||||
|
||||
class _GuildOptional(TypedDict, total=False):
|
||||
icon_hash: Optional[str]
|
||||
owner: bool
|
||||
permissions: str
|
||||
widget_enabled: bool
|
||||
widget_channel_id: Optional[Snowflake]
|
||||
joined_at: Optional[str]
|
||||
large: bool
|
||||
member_count: int
|
||||
voice_states: List[GuildVoiceState]
|
||||
members: List[Member]
|
||||
channels: List[GuildChannel]
|
||||
presences: List[PartialPresenceUpdate]
|
||||
threads: List[Thread]
|
||||
max_presences: Optional[int]
|
||||
max_members: int
|
||||
premium_subscription_count: int
|
||||
max_video_channel_users: int
|
||||
unavailable: NotRequired[bool]
|
||||
|
||||
|
||||
DefaultMessageNotificationLevel = Literal[0, 1]
|
||||
@ -124,7 +102,7 @@ class GuildPreview(_BaseGuildPreview, _GuildPreviewUnique):
|
||||
...
|
||||
|
||||
|
||||
class Guild(_BaseGuildPreview, _GuildOptional):
|
||||
class Guild(_BaseGuildPreview):
|
||||
owner_id: Snowflake
|
||||
region: str
|
||||
afk_channel_id: Optional[Snowflake]
|
||||
@ -147,6 +125,23 @@ class Guild(_BaseGuildPreview, _GuildOptional):
|
||||
stickers: List[GuildSticker]
|
||||
stage_instances: List[StageInstance]
|
||||
guild_scheduled_events: List[GuildScheduledEvent]
|
||||
icon_hash: NotRequired[Optional[str]]
|
||||
owner: NotRequired[bool]
|
||||
permissions: NotRequired[str]
|
||||
widget_enabled: NotRequired[bool]
|
||||
widget_channel_id: NotRequired[Optional[Snowflake]]
|
||||
joined_at: NotRequired[Optional[str]]
|
||||
large: NotRequired[bool]
|
||||
member_count: NotRequired[int]
|
||||
voice_states: NotRequired[List[GuildVoiceState]]
|
||||
members: NotRequired[List[Member]]
|
||||
channels: NotRequired[List[GuildChannel]]
|
||||
presences: NotRequired[List[PartialPresenceUpdate]]
|
||||
threads: NotRequired[List[Thread]]
|
||||
max_presences: NotRequired[Optional[int]]
|
||||
max_members: NotRequired[int]
|
||||
premium_subscription_count: NotRequired[int]
|
||||
max_video_channel_users: NotRequired[int]
|
||||
|
||||
|
||||
class InviteGuild(Guild, total=False):
|
||||
|
@ -25,20 +25,19 @@ DEALINGS IN THE SOFTWARE.
|
||||
from __future__ import annotations
|
||||
|
||||
from typing import Literal, Optional, TypedDict, Union
|
||||
from typing_extensions import NotRequired
|
||||
|
||||
from .snowflake import Snowflake
|
||||
from .user import User
|
||||
|
||||
|
||||
class _IntegrationApplicationOptional(TypedDict, total=False):
|
||||
bot: User
|
||||
|
||||
|
||||
class IntegrationApplication(_IntegrationApplicationOptional):
|
||||
class IntegrationApplication(TypedDict):
|
||||
id: Snowflake
|
||||
name: str
|
||||
icon: Optional[str]
|
||||
description: str
|
||||
summary: str
|
||||
bot: NotRequired[User]
|
||||
|
||||
|
||||
class IntegrationAccount(TypedDict):
|
||||
|
@ -25,7 +25,7 @@ DEALINGS IN THE SOFTWARE.
|
||||
from __future__ import annotations
|
||||
|
||||
from typing import TYPE_CHECKING, Dict, List, Literal, TypedDict, Union
|
||||
|
||||
from typing_extensions import NotRequired
|
||||
|
||||
from .channel import ChannelTypeWithoutThread, ThreadMetadata
|
||||
from .threads import ThreadType
|
||||
@ -120,14 +120,11 @@ ApplicationCommandInteractionDataOption = Union[
|
||||
]
|
||||
|
||||
|
||||
class _BaseApplicationCommandInteractionDataOptional(TypedDict, total=False):
|
||||
resolved: ResolvedData
|
||||
guild_id: Snowflake
|
||||
|
||||
|
||||
class _BaseApplicationCommandInteractionData(_BaseApplicationCommandInteractionDataOptional):
|
||||
class _BaseApplicationCommandInteractionData(TypedDict):
|
||||
id: Snowflake
|
||||
name: str
|
||||
resolved: NotRequired[ResolvedData]
|
||||
guild_id: NotRequired[Snowflake]
|
||||
|
||||
|
||||
class ChatInputApplicationCommandInteractionData(_BaseApplicationCommandInteractionData, total=False):
|
||||
@ -199,18 +196,15 @@ InteractionData = Union[
|
||||
]
|
||||
|
||||
|
||||
class _BaseInteractionOptional(TypedDict, total=False):
|
||||
guild_id: Snowflake
|
||||
channel_id: Snowflake
|
||||
locale: str
|
||||
guild_locale: str
|
||||
|
||||
|
||||
class _BaseInteraction(_BaseInteractionOptional):
|
||||
class _BaseInteraction(TypedDict):
|
||||
id: Snowflake
|
||||
application_id: Snowflake
|
||||
token: str
|
||||
version: Literal[1]
|
||||
guild_id: NotRequired[Snowflake]
|
||||
channel_id: NotRequired[Snowflake]
|
||||
locale: NotRequired[str]
|
||||
guild_locale: NotRequired[str]
|
||||
|
||||
|
||||
class PingInteraction(_BaseInteraction):
|
||||
@ -235,12 +229,9 @@ class ModalSubmitInteraction(_BaseInteraction):
|
||||
Interaction = Union[PingInteraction, ApplicationCommandInteraction, MessageComponentInteraction, ModalSubmitInteraction]
|
||||
|
||||
|
||||
class _MessageInteractionOptional(TypedDict, total=False):
|
||||
member: Member
|
||||
|
||||
|
||||
class MessageInteraction(_MessageInteractionOptional):
|
||||
class MessageInteraction(TypedDict):
|
||||
id: Snowflake
|
||||
type: InteractionType
|
||||
name: str
|
||||
user: User
|
||||
member: NotRequired[Member]
|
||||
|
@ -25,7 +25,7 @@ DEALINGS IN THE SOFTWARE.
|
||||
from __future__ import annotations
|
||||
|
||||
from typing import Literal, Optional, TypedDict, Union
|
||||
|
||||
from typing_extensions import NotRequired, Required
|
||||
|
||||
from .scheduled_event import GuildScheduledEvent
|
||||
from .snowflake import Snowflake
|
||||
@ -37,15 +37,6 @@ from .appinfo import PartialAppInfo
|
||||
InviteTargetType = Literal[1, 2]
|
||||
|
||||
|
||||
class _InviteOptional(TypedDict, total=False):
|
||||
guild: InviteGuild
|
||||
inviter: PartialUser
|
||||
target_user: PartialUser
|
||||
target_type: InviteTargetType
|
||||
target_application: PartialAppInfo
|
||||
guild_scheduled_event: GuildScheduledEvent
|
||||
|
||||
|
||||
class _InviteMetadata(TypedDict, total=False):
|
||||
uses: int
|
||||
max_uses: int
|
||||
@ -55,12 +46,9 @@ class _InviteMetadata(TypedDict, total=False):
|
||||
expires_at: Optional[str]
|
||||
|
||||
|
||||
class _VanityInviteOptional(_InviteMetadata, total=False):
|
||||
revoked: bool
|
||||
|
||||
|
||||
class VanityInvite(_VanityInviteOptional):
|
||||
class VanityInvite(_InviteMetadata):
|
||||
code: Optional[str]
|
||||
revoked: NotRequired[bool]
|
||||
|
||||
|
||||
class IncompleteInvite(_InviteMetadata):
|
||||
@ -68,23 +56,20 @@ class IncompleteInvite(_InviteMetadata):
|
||||
channel: PartialChannel
|
||||
|
||||
|
||||
class Invite(IncompleteInvite, _InviteOptional):
|
||||
...
|
||||
class Invite(IncompleteInvite, total=False):
|
||||
guild: InviteGuild
|
||||
inviter: PartialUser
|
||||
target_user: PartialUser
|
||||
target_type: InviteTargetType
|
||||
target_application: PartialAppInfo
|
||||
guild_scheduled_event: GuildScheduledEvent
|
||||
|
||||
|
||||
class InviteWithCounts(Invite, _GuildPreviewUnique):
|
||||
...
|
||||
|
||||
|
||||
class _GatewayInviteCreateOptional(TypedDict, total=False):
|
||||
guild_id: Snowflake
|
||||
inviter: PartialUser
|
||||
target_type: InviteTargetType
|
||||
target_user: PartialUser
|
||||
target_application: PartialAppInfo
|
||||
|
||||
|
||||
class GatewayInviteCreate(_GatewayInviteCreateOptional):
|
||||
class GatewayInviteCreate(TypedDict):
|
||||
channel_id: Snowflake
|
||||
code: str
|
||||
created_at: str
|
||||
@ -92,15 +77,17 @@ class GatewayInviteCreate(_GatewayInviteCreateOptional):
|
||||
max_uses: int
|
||||
temporary: bool
|
||||
uses: bool
|
||||
|
||||
|
||||
class _GatewayInviteDeleteOptional(TypedDict, total=False):
|
||||
guild_id: Snowflake
|
||||
inviter: NotRequired[PartialUser]
|
||||
target_type: NotRequired[InviteTargetType]
|
||||
target_user: NotRequired[PartialUser]
|
||||
target_application: NotRequired[PartialAppInfo]
|
||||
|
||||
|
||||
class GatewayInviteDelete(_GatewayInviteDeleteOptional):
|
||||
class GatewayInviteDelete(TypedDict):
|
||||
channel_id: Snowflake
|
||||
code: str
|
||||
guild_id: NotRequired[Snowflake]
|
||||
|
||||
|
||||
GatewayInvite = Union[GatewayInviteCreate, GatewayInviteDelete]
|
||||
|
@ -25,6 +25,8 @@ DEALINGS IN THE SOFTWARE.
|
||||
from __future__ import annotations
|
||||
|
||||
from typing import List, Literal, Optional, TypedDict, Union
|
||||
from typing_extensions import NotRequired
|
||||
|
||||
from .snowflake import Snowflake, SnowflakeList
|
||||
from .member import Member, UserWithMember
|
||||
from .user import User
|
||||
@ -36,12 +38,9 @@ from .interactions import MessageInteraction
|
||||
from .sticker import StickerItem
|
||||
|
||||
|
||||
class _PartialMessageOptional(TypedDict, total=False):
|
||||
guild_id: Snowflake
|
||||
|
||||
|
||||
class PartialMessage(_PartialMessageOptional):
|
||||
class PartialMessage(TypedDict):
|
||||
channel_id: Snowflake
|
||||
guild_id: NotRequired[Snowflake]
|
||||
|
||||
|
||||
class ChannelMention(TypedDict):
|
||||
@ -57,21 +56,18 @@ class Reaction(TypedDict):
|
||||
emoji: PartialEmoji
|
||||
|
||||
|
||||
class _AttachmentOptional(TypedDict, total=False):
|
||||
height: Optional[int]
|
||||
width: Optional[int]
|
||||
description: str
|
||||
content_type: str
|
||||
spoiler: bool
|
||||
ephemeral: bool
|
||||
|
||||
|
||||
class Attachment(_AttachmentOptional):
|
||||
class Attachment(TypedDict):
|
||||
id: Snowflake
|
||||
filename: str
|
||||
size: int
|
||||
url: str
|
||||
proxy_url: str
|
||||
height: NotRequired[Optional[int]]
|
||||
width: NotRequired[Optional[int]]
|
||||
description: NotRequired[str]
|
||||
content_type: NotRequired[str]
|
||||
spoiler: NotRequired[bool]
|
||||
ephemeral: NotRequired[bool]
|
||||
|
||||
|
||||
MessageActivityType = Literal[1, 2, 3, 5]
|
||||
@ -82,15 +78,12 @@ class MessageActivity(TypedDict):
|
||||
party_id: str
|
||||
|
||||
|
||||
class _MessageApplicationOptional(TypedDict, total=False):
|
||||
cover_image: str
|
||||
|
||||
|
||||
class MessageApplication(_MessageApplicationOptional):
|
||||
class MessageApplication(TypedDict):
|
||||
id: Snowflake
|
||||
description: str
|
||||
icon: Optional[str]
|
||||
name: str
|
||||
cover_image: NotRequired[str]
|
||||
|
||||
|
||||
class MessageReference(TypedDict, total=False):
|
||||
@ -100,30 +93,11 @@ class MessageReference(TypedDict, total=False):
|
||||
fail_if_not_exists: bool
|
||||
|
||||
|
||||
class _MessageOptional(TypedDict, total=False):
|
||||
guild_id: Snowflake
|
||||
member: Member
|
||||
mention_channels: List[ChannelMention]
|
||||
reactions: List[Reaction]
|
||||
nonce: Union[int, str]
|
||||
webhook_id: Snowflake
|
||||
activity: MessageActivity
|
||||
application: MessageApplication
|
||||
application_id: Snowflake
|
||||
message_reference: MessageReference
|
||||
flags: int
|
||||
sticker_items: List[StickerItem]
|
||||
referenced_message: Optional[Message]
|
||||
interaction: MessageInteraction
|
||||
components: List[Component]
|
||||
|
||||
|
||||
MessageType = Literal[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 14, 15, 18, 19, 20, 21]
|
||||
|
||||
|
||||
class Message(_MessageOptional):
|
||||
class Message(PartialMessage):
|
||||
id: Snowflake
|
||||
channel_id: Snowflake
|
||||
author: User
|
||||
content: str
|
||||
timestamp: str
|
||||
@ -136,6 +110,20 @@ class Message(_MessageOptional):
|
||||
embeds: List[Embed]
|
||||
pinned: bool
|
||||
type: MessageType
|
||||
member: NotRequired[Member]
|
||||
mention_channels: NotRequired[List[ChannelMention]]
|
||||
reactions: NotRequired[List[Reaction]]
|
||||
nonce: NotRequired[Union[int, str]]
|
||||
webhook_id: NotRequired[Snowflake]
|
||||
activity: NotRequired[MessageActivity]
|
||||
application: NotRequired[MessageApplication]
|
||||
application_id: NotRequired[Snowflake]
|
||||
message_reference: NotRequired[MessageReference]
|
||||
flags: NotRequired[int]
|
||||
sticker_items: NotRequired[List[StickerItem]]
|
||||
referenced_message: NotRequired[Optional[Message]]
|
||||
interaction: NotRequired[MessageInteraction]
|
||||
components: NotRequired[List[Component]]
|
||||
|
||||
|
||||
AllowedMentionType = Literal['roles', 'users', 'everyone']
|
||||
|
@ -25,16 +25,12 @@ DEALINGS IN THE SOFTWARE.
|
||||
from __future__ import annotations
|
||||
|
||||
from typing import TypedDict, Optional
|
||||
from typing_extensions import NotRequired
|
||||
|
||||
from .snowflake import Snowflake
|
||||
|
||||
|
||||
class _RoleOptional(TypedDict, total=False):
|
||||
icon: Optional[str]
|
||||
unicode_emoji: Optional[str]
|
||||
tags: RoleTags
|
||||
|
||||
|
||||
class Role(_RoleOptional):
|
||||
class Role(TypedDict):
|
||||
id: Snowflake
|
||||
name: str
|
||||
color: int
|
||||
@ -43,6 +39,9 @@ class Role(_RoleOptional):
|
||||
permissions: str
|
||||
managed: bool
|
||||
mentionable: bool
|
||||
icon: NotRequired[Optional[str]]
|
||||
unicode_emoji: NotRequired[Optional[str]]
|
||||
tags: NotRequired[RoleTags]
|
||||
|
||||
|
||||
class RoleTags(TypedDict, total=False):
|
||||
|
@ -23,6 +23,7 @@ DEALINGS IN THE SOFTWARE.
|
||||
"""
|
||||
|
||||
from typing import List, Literal, Optional, TypedDict, Union
|
||||
from typing_extensions import NotRequired
|
||||
|
||||
from .snowflake import Snowflake
|
||||
from .user import User
|
||||
@ -33,15 +34,7 @@ EventStatus = Literal[1, 2, 3, 4]
|
||||
EntityType = Literal[1, 2, 3]
|
||||
|
||||
|
||||
class _BaseGuildScheduledEventOptional(TypedDict, total=False):
|
||||
creator_id: Optional[Snowflake]
|
||||
description: Optional[str]
|
||||
creator: User
|
||||
user_count: int
|
||||
image: Optional[str]
|
||||
|
||||
|
||||
class _BaseGuildScheduledEvent(_BaseGuildScheduledEventOptional):
|
||||
class _BaseGuildScheduledEvent(TypedDict):
|
||||
id: Snowflake
|
||||
guild_id: Snowflake
|
||||
entity_id: Optional[Snowflake]
|
||||
@ -49,15 +42,17 @@ class _BaseGuildScheduledEvent(_BaseGuildScheduledEventOptional):
|
||||
scheduled_start_time: str
|
||||
privacy_level: PrivacyLevel
|
||||
status: EventStatus
|
||||
creator_id: NotRequired[Optional[Snowflake]]
|
||||
description: NotRequired[Optional[str]]
|
||||
creator: NotRequired[User]
|
||||
user_count: NotRequired[int]
|
||||
image: NotRequired[Optional[str]]
|
||||
|
||||
|
||||
class _VoiceChannelScheduledEventOptional(_BaseGuildScheduledEvent, total=False):
|
||||
scheduled_end_time: Optional[str]
|
||||
|
||||
|
||||
class _VoiceChannelScheduledEvent(_VoiceChannelScheduledEventOptional):
|
||||
class _VoiceChannelScheduledEvent(_BaseGuildScheduledEvent):
|
||||
channel_id: Snowflake
|
||||
entity_metadata: Literal[None]
|
||||
scheduled_end_time: NotRequired[Optional[str]]
|
||||
|
||||
|
||||
class StageInstanceScheduledEvent(_VoiceChannelScheduledEvent):
|
||||
|
@ -25,6 +25,8 @@ DEALINGS IN THE SOFTWARE.
|
||||
from __future__ import annotations
|
||||
|
||||
from typing import List, Literal, TypedDict, Union, Optional
|
||||
from typing_extensions import NotRequired
|
||||
|
||||
from .snowflake import Snowflake
|
||||
from .user import User
|
||||
|
||||
@ -51,14 +53,11 @@ class StandardSticker(BaseSticker):
|
||||
pack_id: Snowflake
|
||||
|
||||
|
||||
class _GuildStickerOptional(TypedDict, total=False):
|
||||
user: User
|
||||
|
||||
|
||||
class GuildSticker(BaseSticker, _GuildStickerOptional):
|
||||
class GuildSticker(BaseSticker):
|
||||
type: Literal[2]
|
||||
available: bool
|
||||
guild_id: Snowflake
|
||||
user: NotRequired[User]
|
||||
|
||||
|
||||
Sticker = Union[StandardSticker, GuildSticker]
|
||||
@ -74,19 +73,10 @@ class StickerPack(TypedDict):
|
||||
banner_asset_id: Optional[Snowflake]
|
||||
|
||||
|
||||
class _CreateGuildStickerOptional(TypedDict, total=False):
|
||||
description: str
|
||||
|
||||
|
||||
class CreateGuildSticker(_CreateGuildStickerOptional):
|
||||
class CreateGuildSticker(TypedDict):
|
||||
name: str
|
||||
tags: str
|
||||
|
||||
|
||||
class EditGuildSticker(TypedDict, total=False):
|
||||
name: str
|
||||
tags: str
|
||||
description: str
|
||||
description: NotRequired[str]
|
||||
|
||||
|
||||
class ListPremiumStickerPacks(TypedDict):
|
||||
|
@ -23,7 +23,9 @@ DEALINGS IN THE SOFTWARE.
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from typing import List, Literal, Optional, TypedDict
|
||||
from typing_extensions import NotRequired
|
||||
|
||||
from .snowflake import Snowflake
|
||||
|
||||
@ -38,26 +40,17 @@ class ThreadMember(TypedDict):
|
||||
flags: int
|
||||
|
||||
|
||||
class _ThreadMetadataOptional(TypedDict, total=False):
|
||||
archiver_id: Snowflake
|
||||
locked: bool
|
||||
invitable: bool
|
||||
create_timestamp: str
|
||||
|
||||
|
||||
class ThreadMetadata(_ThreadMetadataOptional):
|
||||
class ThreadMetadata(TypedDict):
|
||||
archived: bool
|
||||
auto_archive_duration: ThreadArchiveDuration
|
||||
archive_timestamp: str
|
||||
archiver_id: NotRequired[Snowflake]
|
||||
locked: NotRequired[bool]
|
||||
invitable: NotRequired[bool]
|
||||
create_timestamp: NotRequired[str]
|
||||
|
||||
|
||||
class _ThreadOptional(TypedDict, total=False):
|
||||
member: ThreadMember
|
||||
last_message_id: Optional[Snowflake]
|
||||
last_pin_timestamp: Optional[Snowflake]
|
||||
|
||||
|
||||
class Thread(_ThreadOptional):
|
||||
class Thread(TypedDict):
|
||||
id: Snowflake
|
||||
guild_id: Snowflake
|
||||
parent_id: Snowflake
|
||||
@ -68,6 +61,9 @@ class Thread(_ThreadOptional):
|
||||
message_count: int
|
||||
rate_limit_per_user: int
|
||||
thread_metadata: ThreadMetadata
|
||||
member: NotRequired[ThreadMember]
|
||||
last_message_id: NotRequired[Optional[Snowflake]]
|
||||
last_pin_timestamp: NotRequired[Optional[Snowflake]]
|
||||
|
||||
|
||||
class ThreadPaginationPayload(TypedDict):
|
||||
|
@ -23,6 +23,8 @@ DEALINGS IN THE SOFTWARE.
|
||||
"""
|
||||
|
||||
from typing import Optional, TypedDict, List, Literal
|
||||
from typing_extensions import NotRequired
|
||||
|
||||
from .snowflake import Snowflake
|
||||
from .member import MemberWithUser
|
||||
|
||||
@ -30,12 +32,7 @@ from .member import MemberWithUser
|
||||
SupportedModes = Literal['xsalsa20_poly1305_lite', 'xsalsa20_poly1305_suffix', 'xsalsa20_poly1305']
|
||||
|
||||
|
||||
class _PartialVoiceStateOptional(TypedDict, total=False):
|
||||
member: MemberWithUser
|
||||
self_stream: bool
|
||||
|
||||
|
||||
class _VoiceState(_PartialVoiceStateOptional):
|
||||
class _VoiceState(TypedDict):
|
||||
user_id: Snowflake
|
||||
session_id: str
|
||||
deaf: bool
|
||||
@ -44,6 +41,8 @@ class _VoiceState(_PartialVoiceStateOptional):
|
||||
self_mute: bool
|
||||
self_video: bool
|
||||
suppress: bool
|
||||
member: NotRequired[MemberWithUser]
|
||||
self_stream: NotRequired[bool]
|
||||
|
||||
|
||||
class GuildVoiceState(_VoiceState):
|
||||
|
@ -23,7 +23,10 @@ DEALINGS IN THE SOFTWARE.
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from typing import Literal, Optional, TypedDict
|
||||
from typing_extensions import NotRequired
|
||||
|
||||
from .snowflake import Snowflake
|
||||
from .user import User
|
||||
from .channel import PartialChannel
|
||||
@ -35,28 +38,22 @@ class SourceGuild(TypedDict):
|
||||
icon: str
|
||||
|
||||
|
||||
class _WebhookOptional(TypedDict, total=False):
|
||||
guild_id: Snowflake
|
||||
user: User
|
||||
token: str
|
||||
|
||||
|
||||
WebhookType = Literal[1, 2, 3]
|
||||
|
||||
|
||||
class _FollowerWebhookOptional(TypedDict, total=False):
|
||||
source_channel: PartialChannel
|
||||
source_guild: SourceGuild
|
||||
|
||||
|
||||
class FollowerWebhook(_FollowerWebhookOptional):
|
||||
class FollowerWebhook(TypedDict):
|
||||
channel_id: Snowflake
|
||||
webhook_id: Snowflake
|
||||
source_channel: NotRequired[PartialChannel]
|
||||
source_guild: NotRequired[SourceGuild]
|
||||
|
||||
|
||||
class PartialWebhook(_WebhookOptional):
|
||||
class PartialWebhook(TypedDict):
|
||||
id: Snowflake
|
||||
type: WebhookType
|
||||
guild_id: NotRequired[Snowflake]
|
||||
user: NotRequired[User]
|
||||
token: NotRequired[str]
|
||||
|
||||
|
||||
class _FullWebhook(TypedDict, total=False):
|
||||
|
Loading…
x
Reference in New Issue
Block a user