def on_connect(self, func): if not inspect.iscoroutinefunction(func): raise ValueError("You can only register coroutines!") self._connection_callbacks.append(func)