API reference
Reference for extension loading and startup entry points.
Extension loader
loader
Extension loading and initialization logic.
load_extensions() -> tuple[SetupFunctionList, WebserverFunctionList, StartupFunctionList, list[ExtensionTranslation]]
Load extensions from the extensions directory.
Returns:
| Type | Description |
|---|---|
SetupFunctionList
|
A tuple containing: |
WebserverFunctionList
|
|
StartupFunctionList
|
|
list[ExtensionTranslation]
|
|
tuple[SetupFunctionList, WebserverFunctionList, StartupFunctionList, list[ExtensionTranslation]]
|
|
Source code in src/startup/loader.py
58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 | |
find_translation_file(extension_path: Path, extension_name: str) -> Path | None
Find translation file for an extension using centralized path resolution.
Searches in the following order: 1. extension_path/translations.yml 2. extension_path/translations.yaml 3. src/translations/{extension_name}.yml 4. src/translations/{extension_name}.yaml
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
extension_path
|
Path
|
Path to the extension directory |
required |
extension_name
|
str
|
Name of the extension |
required |
Returns:
| Type | Description |
|---|---|
Path | None
|
Path to the translation file if found, None otherwise |
Source code in src/startup/loader.py
27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 | |
Extension utilities
extensions
validate_module(module: ModuleType, config: dict[str, object] | None = None) -> None
Validate the module to ensure it has the required functions and attributes to be loaded as an extension.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
module
|
ModuleType
|
The module to validate |
required |
config
|
dict[str, object] | None
|
The configuration to validate against (currently unused) |
None
|
Raises:
| Type | Description |
|---|---|
AssertionError
|
If the module doesn't meet extension requirements |
Source code in src/utils/extensions.py
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 | |
unzip_extensions() -> None
Source code in src/utils/extensions.py
54 55 56 57 58 59 | |
Startup orchestration
start
Main entry point for starting the bot and backend server.
This module provides the top-level orchestration for the startup process. Most of the actual implementation has been moved to the src.startup package for better organization and maintainability.
start(run_bot: bool | None = None, run_backend: bool | None = None) -> None
async
Start the bot and/or backend server based on configuration.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
run_bot
|
bool | None
|
Whether to start the bot (defaults to config.use.bot) |
None
|
run_backend
|
bool | None
|
Whether to start the backend server (defaults to config.use.backend) |
None
|
Source code in src/start.py
56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 | |