Module graia.application.event.lifecycle

Expand source code
from typing import Any
from graia.broadcast.entities.event import BaseEvent, BaseDispatcher
from graia.broadcast.interfaces.dispatcher import DispatcherInterface
from pydantic.main import BaseModel


class ApplicationLaunched(BaseEvent):
    app: Any

    def __init__(self, app) -> None:
        super().__init__(app=app)

    class Dispatcher(BaseDispatcher):
        @staticmethod
        async def catch(interface: "DispatcherInterface"):
            from .. import GraiaMiraiApplication

            if interface.annotation is GraiaMiraiApplication:
                return interface.event.app


class ApplicationLaunchedBlocking(BaseEvent):
    app: Any

    def __init__(self, app) -> None:
        super().__init__(app=app)

    class Dispatcher(BaseDispatcher):
        @staticmethod
        async def catch(interface: "DispatcherInterface"):
            from .. import GraiaMiraiApplication

            if interface.annotation is GraiaMiraiApplication:
                return interface.event.app


class ApplicationShutdowned(BaseEvent):
    app: Any

    def __init__(self, app) -> None:
        super().__init__(app=app)

    class Dispatcher(BaseDispatcher):
        @staticmethod
        async def catch(interface: "DispatcherInterface"):
            from .. import GraiaMiraiApplication

            if interface.annotation is GraiaMiraiApplication:
                return interface.event.app

Classes

class ApplicationLaunched (app)

Create a new model by parsing and validating input data from keyword arguments.

Raises ValidationError if the input data cannot be parsed to form a valid model.

Expand source code
class ApplicationLaunched(BaseEvent):
    app: Any

    def __init__(self, app) -> None:
        super().__init__(app=app)

    class Dispatcher(BaseDispatcher):
        @staticmethod
        async def catch(interface: "DispatcherInterface"):
            from .. import GraiaMiraiApplication

            if interface.annotation is GraiaMiraiApplication:
                return interface.event.app

Ancestors

  • BaseEvent
  • pydantic.main.BaseModel
  • pydantic.utils.Representation

Class variables

var Dispatcher

所有非单函数型 Dispatcher 的基类, 用于为参数解析提供可扩展的支持.

var app : Any
class ApplicationLaunchedBlocking (app)

Create a new model by parsing and validating input data from keyword arguments.

Raises ValidationError if the input data cannot be parsed to form a valid model.

Expand source code
class ApplicationLaunchedBlocking(BaseEvent):
    app: Any

    def __init__(self, app) -> None:
        super().__init__(app=app)

    class Dispatcher(BaseDispatcher):
        @staticmethod
        async def catch(interface: "DispatcherInterface"):
            from .. import GraiaMiraiApplication

            if interface.annotation is GraiaMiraiApplication:
                return interface.event.app

Ancestors

  • BaseEvent
  • pydantic.main.BaseModel
  • pydantic.utils.Representation

Class variables

var Dispatcher

所有非单函数型 Dispatcher 的基类, 用于为参数解析提供可扩展的支持.

var app : Any
class ApplicationShutdowned (app)

Create a new model by parsing and validating input data from keyword arguments.

Raises ValidationError if the input data cannot be parsed to form a valid model.

Expand source code
class ApplicationShutdowned(BaseEvent):
    app: Any

    def __init__(self, app) -> None:
        super().__init__(app=app)

    class Dispatcher(BaseDispatcher):
        @staticmethod
        async def catch(interface: "DispatcherInterface"):
            from .. import GraiaMiraiApplication

            if interface.annotation is GraiaMiraiApplication:
                return interface.event.app

Ancestors

  • BaseEvent
  • pydantic.main.BaseModel
  • pydantic.utils.Representation

Class variables

var Dispatcher

所有非单函数型 Dispatcher 的基类, 用于为参数解析提供可扩展的支持.

var app : Any