socket-bot/ica-rs/plugins/base.py

14 lines
485 B
Python
Raw Normal View History

2024-02-22 12:47:20 +08:00
from typing import TYPE_CHECKING, TypeVar
if TYPE_CHECKING:
2024-03-16 16:58:18 +08:00
from ica_typing import IcaNewMessage, IcaClient
2024-02-22 12:47:20 +08:00
else:
2024-03-16 16:58:18 +08:00
IcaNewMessage = TypeVar("NewMessage")
2024-02-22 12:47:20 +08:00
IcaClient = TypeVar("IcaClient")
2024-03-16 16:58:18 +08:00
def on_ica_message(msg: IcaNewMessage, client: IcaClient) -> None:
2024-02-22 14:38:37 +08:00
if not (msg.is_from_self or msg.is_reply):
if msg.content == "/bot":
2024-03-16 00:15:49 +08:00
reply = msg.reply_with(f"ica-async-rs({client.version})-sync-py {client.ica_version}")
2024-02-22 12:47:20 +08:00
client.send_message(reply)