CommandSync
Class
Fine-grained sync: targeted read, create, update and delete of commands.
from discord_interactions.slash import CommandSyncConstructor
CommandSync(client: discord.Client)| Name | Type | Default | Description |
|---|---|---|---|
client | discord.Client | required |
Properties
| Name | Type | Description |
|---|---|---|
application_id | int | Get application ID, fetching it if needed. |
Methods
get_global_commands
async def get_global_commands() -> List[Dict[str, Any]]Get all registered global commands.
get_guild_commands
async def get_guild_commands(guild_id: int) -> List[Dict[str, Any]]Get all registered commands for a guild.
bulk_overwrite_global
async def bulk_overwrite_global(commands: List[Dict[str, Any]]) -> List[Dict[str, Any]]Bulk overwrite all global commands.
bulk_overwrite_guild
async def bulk_overwrite_guild( guild_id: int, commands: List[Dict[str, Any]],) -> List[Dict[str, Any]]Bulk overwrite all guild commands.
create_global_command
async def create_global_command(command: Dict[str, Any]) -> Dict[str, Any]Create a single global command.
update_global_command
async def update_global_command( command_id: int, command: Dict[str, Any],) -> Dict[str, Any]Update a single global command.
delete_global_command
async def delete_global_command(command_id: int) -> NoneDelete a global command.
create_guild_command
async def create_guild_command(guild_id: int, command: Dict[str, Any]) -> Dict[str, Any]Create a single guild command.
update_guild_command
async def update_guild_command( guild_id: int, command_id: int, command: Dict[str, Any],) -> Dict[str, Any]Update a single guild command.
delete_guild_command
async def delete_guild_command(guild_id: int, command_id: int) -> NoneDelete a guild command.
sync_global
async def sync_global( commands: List[Dict[str, Any]], mode: SyncMode = SyncMode.FULL,) -> SyncResultSync commands globally.
sync_guild
async def sync_guild( guild_id: int, commands: List[Dict[str, Any]], mode: SyncMode = SyncMode.FULL,) -> SyncResultSync commands to a specific guild.
sync_tree
async def sync_tree( manager: SlashCommandManager, guilds: List[int] | None = None, mode: SyncMode = SyncMode.FULL,) -> Dict[int | None, SyncResult]Sync all commands from a SlashCommandManager.