icalingua-python-bot/ica-rs/ica_typing.py

94 lines
2.0 KiB
Python
Raw Normal View History

2024-02-20 20:11:25 +08:00
# Python 兼容版本 3.8+
from typing import Optional
class IcaStatus:
@property
def login(self) -> bool:
...
@property
def online(self) -> bool:
...
@property
def self_id(self) -> Optional[bool]:
...
@property
def nick_name(self) -> Optional[str]:
...
@property
def ica_version(self) -> Optional[str]:
...
@property
def os_info(self) -> Optional[str]:
...
@property
def resident_set_size(self) -> Optional[str]:
...
@property
def head_used(self) -> Optional[str]:
...
@property
def load_average(self) -> Optional[str]:
...
class ReplyMessage:
...
class SendMessage:
@property
def content(self) -> str:
...
@content.setter
def content(self, value: str) -> None:
...
def with_content(self, content: str) -> "SendMessage":
"""
为了链式调用, 返回自身
"""
self.content = content
return self
2024-02-21 23:07:21 +08:00
class NewMessage:
def reply_with(self, message: str) -> SendMessage:
...
2024-02-22 12:47:20 +08:00
def __str__(self) -> str:
...
@property
def content(self) -> str:
...
@property
def sender_id(self) -> int:
...
@property
def is_from_self(self) -> bool:
...
2024-02-22 14:30:56 +08:00
@property
def is_reply(self) -> bool:
...
2024-02-22 02:40:39 +08:00
class IcaClient:
@staticmethod
2024-02-22 12:47:20 +08:00
async def send_message_a(client: "IcaClient", message: SendMessage) -> bool:
2024-02-22 14:10:11 +08:00
"""
仅作占位, 不能使用
2024-02-22 14:10:11 +08:00
(因为目前来说, rust调用 Python端没法启动一个异步运行时
所以只能 tokio::task::block_in_place 转换成同步调用)
"""
2024-02-22 12:47:20 +08:00
def send_message(self, message: SendMessage) -> bool:
2024-02-22 02:40:39 +08:00
...
2024-02-22 13:06:30 +08:00
def debug(self, message: str) -> None:
...
def info(self, message: str) -> None:
...
def warn(self, message: str) -> None:
...
2024-02-22 12:06:43 +08:00
def on_message(msg: NewMessage, client: IcaClient) -> None:
...