Command Resource¶
Note
The following classes come from the scurrypy.resources.command module.
GuildCommand
dataclass
¶
Bases: Command
Represents a guild command.
guild_id: Optional[int]
instance-attribute
¶
Guild ID of command.
context: Any
instance-attribute
¶
Associated user data.
application_id: int
instance-attribute
¶
Application ID of the commands.
fetch
async
¶
Fetches the command object.
Parameters:
-
command_id(int) –ID of command to fetch
Returns:
-
ApplicationCommandModel–queried application command
fetch_all
async
¶
Fetches ALL guild commands.
Returns:
-
list[ApplicationCommandModel]–queried list of application commands
create
async
¶
Add command to the client.
Danger
Creating a command with the same name as an existing command in the same scope will overwrite the old command.
Parameters:
-
command(SlashCommandPart | UserCommandPart | MessageCommandPart) –command to register
Returns:
-
ApplicationCommandModel–created command
edit
async
¶
Edit a command.
Parameters:
-
command_id(int) –ID of command to edit
-
options(EditGuildCommandParams, default:{}) –command fields to edit
Returns:
-
ApplicationCommandModel–updated application command
delete
async
¶
Delete a command.
Parameters:
-
command_id(int) –ID of command to delete
bulk_overwrite
async
¶
Takes a list of application commands, overwriting the existing global or guild command list for this application.
Warning
Commands that do not already exist will count toward daily application command create limits.
Danger
This will overwrite all types of application commands: slash commands, user commands, and message commands.
Parameters:
-
commands(list[SlashCommandPart | UserCommandPart | MessageCommandPart]) –commands to register
Returns:
-
list[ApplicationCommandModel]–created application commands
GlobalCommand
dataclass
¶
Bases: Command
context: Any
instance-attribute
¶
Associated user data.
application_id: int
instance-attribute
¶
Application ID of the commands.
fetch
async
¶
fetch_all
async
¶
Fetches ALL global commands.
Returns:
-
list[ApplicationCommandModel]–queried list of application commands
create
async
¶
Add command to the client.
Danger
Creating a command with the same name as an existing command in the same scope will overwrite the old command.
Parameters:
-
command(SlashCommandPart | UserCommandPart | MessageCommandPart) –command to register
Returns:
-
ApplicationCommandModel–created command
edit
async
¶
Edit this command.
Parameters:
-
command_id(int) –ID of command to edit
-
options(EditGlobalCommandParams, default:{}) –command fields to edit
Returns:
-
ApplicationCommandModel–updated application command
delete
async
¶
Delete a command.
Parameters:
-
command_id(int) –ID of the command to delete
bulk_overwrite
async
¶
Takes a list of application commands, overwriting the existing global command list for this application.
Warning
Commands that do not already exist will count toward daily application command create limits.
Danger
This will overwrite all types of application commands: slash commands, user commands, and message commands.
Parameters:
-
commands(list[SlashCommandPart | UserCommandPart | MessageCommandPart]) –commands to register
Returns:
-
list[ApplicationCommandModel]–created application commands
Command
dataclass
¶
Bases: BaseResource
Represents a Discord command.