Befehle¶
Die Decorators an Bot und Router erzeugen diese Objekte; Slash-Befehle erklärt sie.
Optionen¶
bostie.Option
dataclass
¶
Option(*, name: str | None = None, description: str | None = None, name_localizations: Mapping[str, str] | None = None, description_localizations: Mapping[str, str] | None = None, autocomplete: AutocompleteCallback | None = None, min: float | None = None, max: float | None = None, min_length: int | None = None, max_length: int | None = None, channel_types: Iterable[ChannelType] | None = None, file_types: Iterable[str] | None = None, choices: Iterable[Choice | ChoiceValue] | None = None, extra: Mapping[str, Any] | None = None)
Option settings, given as Annotated[int, Option(...)] metadata.
Settings here override what the type hint implies.
name_localizations
class-attribute
instance-attribute
¶
description_localizations
class-attribute
instance-attribute
¶
channel_types
class-attribute
instance-attribute
¶
channel_types: Iterable[ChannelType] | None = None
bostie.Choice
dataclass
¶
bostie.Convert
dataclass
¶
bostie.commands.Range
¶
Range[int, 1, 10]: an int, float or str option with inclusive bounds.
Befehle¶
bostie.commands.Command
¶
Command(callback: CommandCallback, *, router: Router, parent: Group | None = None, settings: Mapping[str, Any])
Bases: _Node
A slash command or subcommand built from an async function.
ephemeral
property
¶
ephemeral: bool
Whether answers are ephemeral by default, as set here or on a router.
auto_defer
property
¶
auto_defer: float | None
Seconds before an unanswered use is deferred, as set here or above it.
name_localizations
instance-attribute
¶
name_localizations = dict(settings['name_localizations'] or {})
description_localizations
instance-attribute
¶
description_localizations = dict(settings['description_localizations'] or {})
qualified_name
property
¶
qualified_name: str
The full name as typed after the slash, such as "role color set".
bostie.commands.Group
¶
Group(name: str, description: str, *, router: Router, parent: Group | None = None, settings: Mapping[str, Any])
Bases: _Node
A slash command made of subcommands, or a subcommand group inside one.
ephemeral
property
¶
ephemeral: bool
Whether answers are ephemeral by default, as set here or on a router.
auto_defer
property
¶
auto_defer: float | None
Seconds before an unanswered use is deferred, as set here or above it.
name_localizations
instance-attribute
¶
name_localizations = dict(settings['name_localizations'] or {})
description_localizations
instance-attribute
¶
description_localizations = dict(settings['description_localizations'] or {})
qualified_name
property
¶
qualified_name: str
The full name as typed after the slash, such as "role color set".
group
¶
group(name: str, description: str, *, name_localizations: Mapping[str, str] | None = None, description_localizations: Mapping[str, str] | None = None, checks: Iterable[Check] = (), extra: Mapping[str, Any] | None = None) -> Group
Add a subcommand group; groups nest one level deep at most.
command
¶
command(callback: CommandCallback) -> Command
command(callback: None = None, /, *, name: str | None = None, description: str | None = None, name_localizations: Mapping[str, str] | None = None, description_localizations: Mapping[str, str] | None = None, ephemeral: bool | None = None, auto_defer: float | Unset | None = UNSET, checks: Iterable[Check] = (), extra: Mapping[str, Any] | None = None) -> Callable[[CommandCallback], Command]
command(callback: CommandCallback | None = None, /, *, name: str | None = None, description: str | None = None, name_localizations: Mapping[str, str] | None = None, description_localizations: Mapping[str, str] | None = None, ephemeral: bool | None = None, auto_defer: float | Unset | None = UNSET, checks: Iterable[Check] = (), extra: Mapping[str, Any] | None = None) -> Command | Callable[[CommandCallback], Command]
Add a subcommand, as @group.command or @group.command(name=...).
bostie.commands.ContextMenuCommand
¶
ContextMenuCommand(type: _TargetType, name: str, callback: CommandCallback, *, router: Router, settings: Mapping[str, Any])
Bases: _Registered
A user or message command, run from the context menu of its target.
ephemeral
property
¶
ephemeral: bool
Whether answers are ephemeral by default, as set here or on a router.
auto_defer
property
¶
auto_defer: float | None
Seconds before an unanswered use is deferred, as set here or above it.
name_localizations
instance-attribute
¶
name_localizations = dict(settings['name_localizations'] or {})
bostie.commands.EntryPointCommand
¶
EntryPointCommand(name: str, callback: CommandCallback, *, router: Router, settings: Mapping[str, Any])
Bases: _Registered
The app's entry point command, which opens its Activity from the App Launcher.
description_localizations
instance-attribute
¶
description_localizations = dict(settings['description_localizations'] or {})
ephemeral
property
¶
ephemeral: bool
Whether answers are ephemeral by default, as set here or on a router.
auto_defer
property
¶
auto_defer: float | None
Seconds before an unanswered use is deferred, as set here or above it.
name_localizations
instance-attribute
¶
name_localizations = dict(settings['name_localizations'] or {})
Routen¶
bostie.custom_id.ComponentRoute
¶
ComponentRoute(template: str, handler: Callable[P, Coroutine[Any, Any, None]], *, router: Router, settings: Mapping[str, Any])
Bases: Answering
A component or modal handler for a custom_id template like "vote:{up:int}".
ephemeral
property
¶
ephemeral: bool
Whether answers are ephemeral by default, as set here or on a router.
auto_defer
property
¶
auto_defer: float | None
Seconds before an unanswered use is deferred, as set here or above it.
id
¶
Build a custom_id that fits in 100 characters and parses back to params.
match
¶
The placeholder values in custom_id, or None if it does not fit.
Synchronisierung¶
bostie.SyncResult
dataclass
¶
SyncResult(guild_id: int | None, added: tuple[str, ...], removed: tuple[str, ...], changed: tuple[str, ...], ids: Mapping[str, int] = dict[str, int]())
Commands that differed in one scope; guild_id is None for global.
ids holds the id Discord gave each slash command of the scope, by name.