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

Function conn_hook

tests/test_driver.py:923–933  ·  view source on GitHub ↗
(foo: Bot, dep: int = Depends(dependency), default: int = 1)

Source from the content-addressed store, hash-verified

921
922 @driver.on_bot_connect
923 async def conn_hook(foo: Bot, dep: int = Depends(dependency), default: int = 1):
924 nonlocal conn_should_be_called
925
926 if foo is not bot:
927 pytest.fail("on_bot_connect hook called with wrong bot")
928 if dep != 1:
929 pytest.fail("on_bot_connect hook called with wrong dependency")
930 if default != 1:
931 pytest.fail("on_bot_connect hook called with wrong default value")
932
933 conn_should_be_called = True
934
935 @driver.on_bot_disconnect
936 async def disconn_hook(

Callers

nothing calls this directly

Calls 1

DependsFunction · 0.90

Tested by

no test coverage detected