Commands Contexts¶
ctx
¶
CommandOptionValue = int | float | bool | str
¶
Possible types in which a command option value can be converted.
CommandContext
dataclass
¶
Bases: InteractionContext
flowchart TD
scurrypy.ext.commands.ctx.CommandContext[CommandContext]
scurrypy.ext.interactions.ctx.InteractionContext[InteractionContext]
scurrypy.resources.interaction.Interaction[Interaction]
scurrypy.resources.base_resource.BaseResource[BaseResource]
scurrypy.ext.interactions.ctx.InteractionContext --> scurrypy.ext.commands.ctx.CommandContext
scurrypy.resources.interaction.Interaction --> scurrypy.ext.interactions.ctx.InteractionContext
scurrypy.resources.base_resource.BaseResource --> scurrypy.resources.interaction.Interaction
click scurrypy.ext.commands.ctx.CommandContext href "" "scurrypy.ext.commands.ctx.CommandContext"
click scurrypy.ext.interactions.ctx.InteractionContext href "" "scurrypy.ext.interactions.ctx.InteractionContext"
click scurrypy.resources.interaction.Interaction href "" "scurrypy.resources.interaction.Interaction"
click scurrypy.resources.base_resource.BaseResource href "" "scurrypy.resources.base_resource.BaseResource"
ApplicationCommandContext
dataclass
¶
Bases: CommandContext
flowchart TD
scurrypy.ext.commands.ctx.ApplicationCommandContext[ApplicationCommandContext]
scurrypy.ext.commands.ctx.CommandContext[CommandContext]
scurrypy.ext.interactions.ctx.InteractionContext[InteractionContext]
scurrypy.resources.interaction.Interaction[Interaction]
scurrypy.resources.base_resource.BaseResource[BaseResource]
scurrypy.ext.commands.ctx.CommandContext --> scurrypy.ext.commands.ctx.ApplicationCommandContext
scurrypy.ext.interactions.ctx.InteractionContext --> scurrypy.ext.commands.ctx.CommandContext
scurrypy.resources.interaction.Interaction --> scurrypy.ext.interactions.ctx.InteractionContext
scurrypy.resources.base_resource.BaseResource --> scurrypy.resources.interaction.Interaction
click scurrypy.ext.commands.ctx.ApplicationCommandContext href "" "scurrypy.ext.commands.ctx.ApplicationCommandContext"
click scurrypy.ext.commands.ctx.CommandContext href "" "scurrypy.ext.commands.ctx.CommandContext"
click scurrypy.ext.interactions.ctx.InteractionContext href "" "scurrypy.ext.interactions.ctx.InteractionContext"
click scurrypy.resources.interaction.Interaction href "" "scurrypy.resources.interaction.Interaction"
click scurrypy.resources.base_resource.BaseResource href "" "scurrypy.resources.base_resource.BaseResource"
event: JsonQuery
instance-attribute
¶
get_option
¶
Get a command option input value by name converted to its appropriate type.
Parameters:
-
option_name(str) –name of option
Raises:
-
OptionNotFound–command option not found
Returns:
-
CommandOptionValue | None–converted command input value or None if no command options are present
AutocompleteApplicationCommandContext
dataclass
¶
Bases: CommandContext
flowchart TD
scurrypy.ext.commands.ctx.AutocompleteApplicationCommandContext[AutocompleteApplicationCommandContext]
scurrypy.ext.commands.ctx.CommandContext[CommandContext]
scurrypy.ext.interactions.ctx.InteractionContext[InteractionContext]
scurrypy.resources.interaction.Interaction[Interaction]
scurrypy.resources.base_resource.BaseResource[BaseResource]
scurrypy.ext.commands.ctx.CommandContext --> scurrypy.ext.commands.ctx.AutocompleteApplicationCommandContext
scurrypy.ext.interactions.ctx.InteractionContext --> scurrypy.ext.commands.ctx.CommandContext
scurrypy.resources.interaction.Interaction --> scurrypy.ext.interactions.ctx.InteractionContext
scurrypy.resources.base_resource.BaseResource --> scurrypy.resources.interaction.Interaction
click scurrypy.ext.commands.ctx.AutocompleteApplicationCommandContext href "" "scurrypy.ext.commands.ctx.AutocompleteApplicationCommandContext"
click scurrypy.ext.commands.ctx.CommandContext href "" "scurrypy.ext.commands.ctx.CommandContext"
click scurrypy.ext.interactions.ctx.InteractionContext href "" "scurrypy.ext.interactions.ctx.InteractionContext"
click scurrypy.resources.interaction.Interaction href "" "scurrypy.resources.interaction.Interaction"
click scurrypy.resources.base_resource.BaseResource href "" "scurrypy.resources.base_resource.BaseResource"
convert_option_value
¶
Converts the option's value based on the option's type.
Parameters:
-
option(JsonQuery) –command option
Returns:
-
CommandOptionValue–converted command option value