|
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 | 36 | await bot.start( |
37 | 37 | token=token, |
38 | 38 | public_key=public_key, |
| 39 | + health=rest_config.health, |
39 | 40 | uvicorn_options={ |
40 | | - "host": "0.0.0.0", # noqa: S104 |
41 | | - "port": 6000, |
| 41 | + "host": rest_config.host, |
| 42 | + "port": rest_config.port, |
42 | 43 | }, |
43 | 44 | ) |
44 | 45 | else: |
@@ -172,7 +173,7 @@ async def setup_and_start_bot( |
172 | 173 | bot.prefixed_commands = {} |
173 | 174 | if not config.slash: |
174 | 175 | bot._pending_application_commands = [] # pyright: ignore[reportPrivateUsage] |
175 | | - await start_bot(bot, config.token, config.public_key) |
| 176 | + await start_bot(bot, config.token, config.rest, config.public_key) |
176 | 177 |
|
177 | 178 |
|
178 | 179 | async def setup_and_start_backend( |
|
0 commit comments