mirror of
https://github.com/Rapptz/discord.py.git
synced 2025-05-10 07:49:48 +00:00
Type-Hint http.py
This commit is contained in:
parent
11e23c534a
commit
35a9533e8d
763
discord/http.py
763
discord/http.py
File diff suppressed because it is too large
Load Diff
@ -28,9 +28,12 @@ from .snowflake import Snowflake
|
|||||||
from .threads import ThreadMetadata, ThreadMember
|
from .threads import ThreadMetadata, ThreadMember
|
||||||
|
|
||||||
|
|
||||||
|
OverwriteType = Literal[0, 1]
|
||||||
|
|
||||||
|
|
||||||
class PermissionOverwrite(TypedDict):
|
class PermissionOverwrite(TypedDict):
|
||||||
id: Snowflake
|
id: Snowflake
|
||||||
type: Literal[0, 1]
|
type: OverwriteType
|
||||||
allow: str
|
allow: str
|
||||||
deny: str
|
deny: str
|
||||||
|
|
||||||
|
@ -39,3 +39,8 @@ class Emoji(PartialEmoji, total=False):
|
|||||||
managed: bool
|
managed: bool
|
||||||
animated: bool
|
animated: bool
|
||||||
available: bool
|
available: bool
|
||||||
|
|
||||||
|
|
||||||
|
class EditEmoji(TypedDict):
|
||||||
|
name: str
|
||||||
|
roles: Optional[SnowflakeList]
|
||||||
|
41
discord/types/gateway.py
Normal file
41
discord/types/gateway.py
Normal file
@ -0,0 +1,41 @@
|
|||||||
|
"""
|
||||||
|
The MIT License (MIT)
|
||||||
|
|
||||||
|
Copyright (c) 2015-present Rapptz
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a
|
||||||
|
copy of this software and associated documentation files (the "Software"),
|
||||||
|
to deal in the Software without restriction, including without limitation
|
||||||
|
the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||||
|
and/or sell copies of the Software, and to permit persons to whom the
|
||||||
|
Software is furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in
|
||||||
|
all copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||||
|
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||||
|
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||||
|
DEALINGS IN THE SOFTWARE.
|
||||||
|
"""
|
||||||
|
|
||||||
|
from typing import TypedDict
|
||||||
|
|
||||||
|
|
||||||
|
class SessionStartLimit(TypedDict):
|
||||||
|
total: int
|
||||||
|
remaining: int
|
||||||
|
reset_after: int
|
||||||
|
max_concurrency: int
|
||||||
|
|
||||||
|
|
||||||
|
class Gateway(TypedDict):
|
||||||
|
url: str
|
||||||
|
|
||||||
|
|
||||||
|
class GatewayBot(Gateway):
|
||||||
|
shards: int
|
||||||
|
session_start_limit: SessionStartLimit
|
@ -140,3 +140,20 @@ class InviteGuild(Guild, total=False):
|
|||||||
|
|
||||||
class GuildWithCounts(Guild, _GuildPreviewUnique):
|
class GuildWithCounts(Guild, _GuildPreviewUnique):
|
||||||
...
|
...
|
||||||
|
|
||||||
|
|
||||||
|
class GuildPrune(TypedDict):
|
||||||
|
pruned: Optional[int]
|
||||||
|
|
||||||
|
|
||||||
|
class ChannelPositionUpdate(TypedDict):
|
||||||
|
id: Snowflake
|
||||||
|
position: Optional[int]
|
||||||
|
lock_permissions: Optional[bool]
|
||||||
|
parent_id: Optional[Snowflake]
|
||||||
|
|
||||||
|
class _RolePositionRequired(TypedDict):
|
||||||
|
id: Snowflake
|
||||||
|
|
||||||
|
class RolePositionUpdate(_RolePositionRequired, total=False):
|
||||||
|
position: Optional[Snowflake]
|
||||||
|
@ -24,7 +24,7 @@ DEALINGS IN THE SOFTWARE.
|
|||||||
|
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
from typing import TYPE_CHECKING, Dict, TypedDict, Union, List, Literal
|
from typing import Optional, TYPE_CHECKING, Dict, TypedDict, Union, List, Literal
|
||||||
from .snowflake import Snowflake
|
from .snowflake import Snowflake
|
||||||
from .components import Component, ComponentType
|
from .components import Component, ComponentType
|
||||||
from .embed import Embed
|
from .embed import Embed
|
||||||
@ -77,11 +77,14 @@ class ApplicationCommandPermissions(TypedDict):
|
|||||||
permission: bool
|
permission: bool
|
||||||
|
|
||||||
|
|
||||||
class PartialGuildApplicationCommandPermissions(TypedDict):
|
class BaseGuildApplicationCommandPermissions(TypedDict):
|
||||||
id: Snowflake
|
|
||||||
permissions: List[ApplicationCommandPermissions]
|
permissions: List[ApplicationCommandPermissions]
|
||||||
|
|
||||||
|
|
||||||
|
class PartialGuildApplicationCommandPermissions(BaseGuildApplicationCommandPermissions):
|
||||||
|
id: Snowflake
|
||||||
|
|
||||||
|
|
||||||
class GuildApplicationCommandPermissions(PartialGuildApplicationCommandPermissions):
|
class GuildApplicationCommandPermissions(PartialGuildApplicationCommandPermissions):
|
||||||
application_id: Snowflake
|
application_id: Snowflake
|
||||||
guild_id: Snowflake
|
guild_id: Snowflake
|
||||||
@ -95,7 +98,9 @@ class _ApplicationCommandInteractionDataOptionOptional(TypedDict, total=False):
|
|||||||
options: List[ApplicationCommandInteractionDataOption]
|
options: List[ApplicationCommandInteractionDataOption]
|
||||||
|
|
||||||
|
|
||||||
class ApplicationCommandInteractionDataOption(_ApplicationCommandInteractionDataOptionOptional):
|
class ApplicationCommandInteractionDataOption(
|
||||||
|
_ApplicationCommandInteractionDataOptionOptional
|
||||||
|
):
|
||||||
name: str
|
name: str
|
||||||
type: ApplicationCommandOptionType
|
type: ApplicationCommandOptionType
|
||||||
|
|
||||||
@ -149,6 +154,7 @@ class Interaction(_InteractionOptional):
|
|||||||
token: str
|
token: str
|
||||||
version: int
|
version: int
|
||||||
|
|
||||||
|
|
||||||
class InteractionApplicationCommandCallbackData(TypedDict, total=False):
|
class InteractionApplicationCommandCallbackData(TypedDict, total=False):
|
||||||
tts: bool
|
tts: bool
|
||||||
content: str
|
content: str
|
||||||
@ -174,3 +180,10 @@ class MessageInteraction(TypedDict):
|
|||||||
type: InteractionType
|
type: InteractionType
|
||||||
name: str
|
name: str
|
||||||
user: User
|
user: User
|
||||||
|
|
||||||
|
|
||||||
|
class EditApplicationCommand(TypedDict):
|
||||||
|
name: str
|
||||||
|
description: str
|
||||||
|
options: Optional[List[ApplicationCommandOption]]
|
||||||
|
default_permission: bool
|
||||||
|
@ -52,6 +52,10 @@ class _InviteMetadata(TypedDict, total=False):
|
|||||||
expires_at: Optional[str]
|
expires_at: Optional[str]
|
||||||
|
|
||||||
|
|
||||||
|
class VanityInvite(_InviteMetadata):
|
||||||
|
code: Optional[str]
|
||||||
|
|
||||||
|
|
||||||
class IncompleteInvite(_InviteMetadata):
|
class IncompleteInvite(_InviteMetadata):
|
||||||
code: str
|
code: str
|
||||||
channel: PartialChannel
|
channel: PartialChannel
|
||||||
|
@ -27,6 +27,10 @@ from .snowflake import SnowflakeList
|
|||||||
from .user import User
|
from .user import User
|
||||||
|
|
||||||
|
|
||||||
|
class Nickname(TypedDict):
|
||||||
|
nick: str
|
||||||
|
|
||||||
|
|
||||||
class PartialMember(TypedDict):
|
class PartialMember(TypedDict):
|
||||||
roles: SnowflakeList
|
roles: SnowflakeList
|
||||||
joined_at: str
|
joined_at: str
|
||||||
|
@ -30,6 +30,11 @@ from .user import User
|
|||||||
from .guild import Guild
|
from .guild import Guild
|
||||||
|
|
||||||
|
|
||||||
|
class CreateTemplate(TypedDict):
|
||||||
|
name: str
|
||||||
|
icon: Optional[bytes]
|
||||||
|
|
||||||
|
|
||||||
class Template(TypedDict):
|
class Template(TypedDict):
|
||||||
code: str
|
code: str
|
||||||
name: str
|
name: str
|
||||||
|
@ -27,7 +27,7 @@ from typing import List, Literal, Optional, TypedDict
|
|||||||
|
|
||||||
from .snowflake import Snowflake
|
from .snowflake import Snowflake
|
||||||
|
|
||||||
ThreadTypes = Literal[10, 11, 12]
|
ThreadType = Literal[10, 11, 12]
|
||||||
ThreadArchiveDuration = Literal[60, 1440, 4320, 10080]
|
ThreadArchiveDuration = Literal[60, 1440, 4320, 10080]
|
||||||
|
|
||||||
|
|
||||||
@ -61,7 +61,7 @@ class Thread(_ThreadOptional):
|
|||||||
parent_id: Snowflake
|
parent_id: Snowflake
|
||||||
owner_id: Snowflake
|
owner_id: Snowflake
|
||||||
name: str
|
name: str
|
||||||
type: ThreadTypes
|
type: ThreadType
|
||||||
member_count: int
|
member_count: int
|
||||||
message_count: int
|
message_count: int
|
||||||
rate_limit_per_user: int
|
rate_limit_per_user: int
|
||||||
|
Loading…
x
Reference in New Issue
Block a user