|
16 | 16 |
|
17 | 17 | from src import custom, i18n |
18 | 18 | from src.config import config |
19 | | -from src.config.models import BotConfig, Extension |
| 19 | +from src.config.models import BotConfig, Extension, RestConfig |
20 | 20 | from src.i18n.classes import ExtensionTranslation |
21 | 21 | from src.log import logger, patch |
22 | 22 | from src.utils import setup_func, unzip_extensions, validate_module |
|
28 | 28 | FunctionlistType = list[tuple[Callable[..., Any], Extension]] |
29 | 29 |
|
30 | 30 |
|
31 | | -async def start_bot(bot: custom.Bot, token: str, public_key: str | None = None) -> None: |
| 31 | +async def start_bot(bot: custom.Bot, token: str, rest_config: RestConfig, public_key: str | None = None) -> None: |
32 | 32 | try: |
33 | 33 | if isinstance(bot, custom.CustomRestBot): |
34 | 34 | if not public_key: |
35 | 35 | raise TypeError("CustomRestBot requires a public key to start.") # noqa: TRY301 |
36 | | - await bot.start(token=token, public_key=public_key) |
| 36 | + await bot.start( |
| 37 | + token=token, |
| 38 | + public_key=public_key, |
| 39 | + health=rest_config.health, |
| 40 | + uvicorn_options={ |
| 41 | + "host": rest_config.host, |
| 42 | + "port": rest_config.port, |
| 43 | + }, |
| 44 | + ) |
37 | 45 | else: |
38 | 46 | await bot.start(token) |
39 | 47 | except LoginFailure as e: |
@@ -165,7 +173,7 @@ async def setup_and_start_bot( |
165 | 173 | bot.prefixed_commands = {} |
166 | 174 | if not config.slash: |
167 | 175 | bot._pending_application_commands = [] # pyright: ignore[reportPrivateUsage] |
168 | | - await start_bot(bot, config.token, config.public_key) |
| 176 | + await start_bot(bot, config.token, config.rest, config.public_key) |
169 | 177 |
|
170 | 178 |
|
171 | 179 | async def setup_and_start_backend( |
|
0 commit comments