From 6b288f0e6034b6de91da644c1a0dfc0c2b1a3031 Mon Sep 17 00:00:00 2001 From: Richard Chien Date: Mon, 16 Mar 2020 21:04:43 +0800 Subject: [PATCH] adjust on_websocket_connect --- nonebot/__init__.py | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/nonebot/__init__.py b/nonebot/__init__.py index 5e6ae3fa..14b43dd1 100644 --- a/nonebot/__init__.py +++ b/nonebot/__init__.py @@ -113,18 +113,14 @@ def on_startup(func: Callable[[], Awaitable[None]]) \ return get_bot().server_app.before_serving(func) -def on_websocket_connect(func: Callable[[], Awaitable[None]]) \ +def on_websocket_connect(func: Callable[[aiocqhttp.Event], Awaitable[None]]) \ -> Callable[[], Awaitable[None]]: """ Decorator to register a function as websocket connect callback. Only work with CQHTTP v4.14+. """ - - async def _func(event: aiocqhttp.Event): - await func() - - return get_bot().on_meta_event('lifecycle.connect')(_func) + return get_bot().on_meta_event('lifecycle.connect')(func) from .exceptions import *