Add types for ApplicationCommandPermissions & co
This commit is contained in:
parent
66b17f5afb
commit
b705173676
@ -1303,6 +1303,44 @@ class HTTPClient:
|
|||||||
)
|
)
|
||||||
return self.request(r)
|
return self.request(r)
|
||||||
|
|
||||||
|
def get_guild_application_command_permissions(self, application_id, guild_id) -> Response[List[interactions.GuildApplicationCommandPermissions]]:
|
||||||
|
r = Route(
|
||||||
|
'GET',
|
||||||
|
'/applications/{application_id}/guilds/{guild_id}/commands/permissions',
|
||||||
|
application_id=application_id,
|
||||||
|
guild_id=guild_id,
|
||||||
|
)
|
||||||
|
return self.request(r)
|
||||||
|
|
||||||
|
def get_application_command_permissions(self, application_id, guild_id, command_id) -> Response[interactions.GuildApplicationCommandPermissions]:
|
||||||
|
r = Route(
|
||||||
|
'GET',
|
||||||
|
'/applications/{application_id}/guilds/{guild_id}/commands/{command_id}/permissions',
|
||||||
|
application_id=application_id,
|
||||||
|
guild_id=guild_id,
|
||||||
|
command_id=command_id,
|
||||||
|
)
|
||||||
|
return self.request(r)
|
||||||
|
|
||||||
|
def edit_application_command_permissions(self, application_id, guild_id, command_id, payload):
|
||||||
|
r = Route(
|
||||||
|
'PUT',
|
||||||
|
'/applications/{application_id}/guilds/{guild_id}/commands/{command_id}/permissions',
|
||||||
|
application_id=application_id,
|
||||||
|
guild_id=guild_id,
|
||||||
|
command_id=command_id,
|
||||||
|
)
|
||||||
|
return self.request(r, json=payload)
|
||||||
|
|
||||||
|
def bulk_edit_guild_application_command_permissions(self, application_id, guild_id, payload):
|
||||||
|
r = Route(
|
||||||
|
'PUT',
|
||||||
|
'/applications/{application_id}/guilds/{guild_id}/commands/permissions',
|
||||||
|
application_id=application_id,
|
||||||
|
guild_id=guild_id,
|
||||||
|
)
|
||||||
|
return self.request(r, json=payload)
|
||||||
|
|
||||||
# Misc
|
# Misc
|
||||||
|
|
||||||
def application_info(self):
|
def application_info(self):
|
||||||
|
@ -24,11 +24,13 @@ DEALINGS IN THE SOFTWARE.
|
|||||||
|
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
from typing import TypedDict, Union, List, Literal
|
from typing import Dict, TypedDict, Union, List, Literal
|
||||||
from .snowflake import Snowflake
|
from .snowflake import Snowflake
|
||||||
from .message import AllowedMentions
|
from .message import AllowedMentions
|
||||||
|
from .channel import PartialChannel
|
||||||
from .embed import Embed
|
from .embed import Embed
|
||||||
from .member import Member
|
from .member import Member
|
||||||
|
from .role import Role
|
||||||
from .user import User
|
from .user import User
|
||||||
|
|
||||||
|
|
||||||
@ -48,7 +50,7 @@ class _ApplicationCommandOptionOptional(TypedDict, total=False):
|
|||||||
options: List[ApplicationCommandOption]
|
options: List[ApplicationCommandOption]
|
||||||
|
|
||||||
|
|
||||||
ApplicationCommandOptionType = Literal[1, 2, 3, 4, 5, 6, 7, 8]
|
ApplicationCommandOptionType = Literal[1, 2, 3, 4, 5, 6, 7, 8, 9]
|
||||||
|
|
||||||
|
|
||||||
class ApplicationCommandOption(_ApplicationCommandOptionOptional):
|
class ApplicationCommandOption(_ApplicationCommandOptionOptional):
|
||||||
@ -63,6 +65,25 @@ class ApplicationCommandOptionChoice(TypedDict):
|
|||||||
value: Union[str, int]
|
value: Union[str, int]
|
||||||
|
|
||||||
|
|
||||||
|
ApplicationCommandPermissionType = Literal[1, 2]
|
||||||
|
|
||||||
|
|
||||||
|
class ApplicationCommandPermissions(TypedDict):
|
||||||
|
id: Snowflake
|
||||||
|
type: ApplicationCommandPermissionType
|
||||||
|
permission: bool
|
||||||
|
|
||||||
|
|
||||||
|
class PartialGuildApplicationCommandPermissions(TypedDict):
|
||||||
|
id: Snowflake
|
||||||
|
permissions: List[ApplicationCommandPermissions]
|
||||||
|
|
||||||
|
|
||||||
|
class GuildApplicationCommandPermissions(PartialGuildApplicationCommandPermissions):
|
||||||
|
application_id: Snowflake
|
||||||
|
guild_id: Snowflake
|
||||||
|
|
||||||
|
|
||||||
InteractionType = Literal[1, 2]
|
InteractionType = Literal[1, 2]
|
||||||
|
|
||||||
|
|
||||||
@ -73,10 +94,19 @@ class _ApplicationCommandInteractionDataOptionOptional(TypedDict, total=False):
|
|||||||
|
|
||||||
class ApplicationCommandInteractionDataOption(_ApplicationCommandInteractionDataOptionOptional):
|
class ApplicationCommandInteractionDataOption(_ApplicationCommandInteractionDataOptionOptional):
|
||||||
name: str
|
name: str
|
||||||
|
type: ApplicationCommandOptionType
|
||||||
|
|
||||||
|
|
||||||
|
class ApplicationCommandInteractionDataResolved(TypedDict, total=False):
|
||||||
|
users: Dict[Snowflake, User]
|
||||||
|
members: Dict[Snowflake, Member]
|
||||||
|
roles: Dict[Snowflake, Role]
|
||||||
|
channels: Dict[Snowflake, PartialChannel]
|
||||||
|
|
||||||
|
|
||||||
class _ApplicationCommandInteractionDataOptional(TypedDict, total=False):
|
class _ApplicationCommandInteractionDataOptional(TypedDict, total=False):
|
||||||
options: List[ApplicationCommandInteractionDataOption]
|
options: List[ApplicationCommandInteractionDataOption]
|
||||||
|
resolved: ApplicationCommandInteractionDataResolved
|
||||||
|
|
||||||
|
|
||||||
class ApplicationCommandInteractionData(_ApplicationCommandInteractionDataOptional):
|
class ApplicationCommandInteractionData(_ApplicationCommandInteractionDataOptional):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user