-
-
Notifications
You must be signed in to change notification settings - Fork 14
/
capability.py
29 lines (21 loc) · 951 Bytes
/
capability.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
from __future__ import annotations
from typing import Any, TypeVar
from graia.amnesia.message import Element as GraiaElement
from nonechat.info import Event as ConsoleEvent
from nonechat.message import Element as ConsoleElement
from avilla.core.event import AvillaEvent
from avilla.core.ryanvk.collector.application import ApplicationCollector
from graia.ryanvk import Fn, TypeOverload
CE = TypeVar("CE", bound=ConsoleElement)
GE = TypeVar("GE", bound=GraiaElement)
CV = TypeVar("CV", bound=ConsoleEvent)
class ConsoleCapability((m := ApplicationCollector())._):
@Fn.complex({TypeOverload(): ["event"]})
async def event_callback(self, event: Any) -> AvillaEvent:
...
@Fn.complex({TypeOverload(): ["element"]})
async def deserialize_element(self, element: Any) -> GraiaElement:
...
@Fn.complex({TypeOverload(): ["element"]})
async def serialize_element(self, element: Any) -> ConsoleElement:
...