-
-
Notifications
You must be signed in to change notification settings - Fork 14
/
Copy pathaccount.py
41 lines (32 loc) · 1.02 KB
/
account.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
30
31
32
33
34
35
36
37
38
39
40
41
from __future__ import annotations
from typing import TYPE_CHECKING
from avilla.core.account import AccountStatus, BaseAccount
from avilla.core.platform import Abstract, Land, Platform
from avilla.core.selector import Selector
if TYPE_CHECKING:
from .protocol import ConsoleProtocol
PLATFORM = Platform(
Land(
"console",
[{"name": "GraiaProject"}],
humanized_name="Console Interface for Avilla",
),
Abstract(
protocol="Console",
maintainers=[{"name": "yanyongyu"}],
humanized_name="Textual Console",
),
)
class ConsoleAccount(BaseAccount):
protocol: ConsoleProtocol
status: AccountStatus
def __init__(self, protocol: ConsoleProtocol):
super().__init__(Selector().land("console").account(protocol.name), protocol.avilla)
self.protocol = protocol
self.status = AccountStatus()
@property
def client(self):
return self.protocol.service.app
@property
def available(self) -> bool:
return self.status.enabled