MCPcopy
hub / github.com/nonebot/nonebot2 / init

Function init

packages/nonebot-plugin-docs/nonebot_plugin_docs/__init__.py:18–35  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

16
17
18def init():
19 driver = nonebot.get_driver()
20 try:
21 _module = importlib.import_module(
22 f"nonebot_plugin_docs.drivers.{driver.type.split('+')[0]}"
23 )
24 except ImportError:
25 logger.warning(f"Driver {driver.type} not supported")
26 return
27 register_route = getattr(_module, "register_route")
28 register_route(driver)
29 host = str(driver.config.host)
30 port = driver.config.port
31 if host in {"0.0.0.0", "127.0.0.1"}:
32 host = "localhost"
33 logger.opt(colors=True).info(
34 f"Nonebot docs will be running at: <b><u>http://{host}:{port}/website/</u></b>"
35 )
36
37
38init()

Callers 1

__init__.pyFile · 0.70

Calls 1

register_routeFunction · 0.85

Tested by

no test coverage detected