add tailchat adapt for namerena plugin

This commit is contained in:
shenjack-5600u 2024-06-05 12:51:19 +08:00
parent 6bbbaf4cc6
commit bf40679012
Signed by: shenjack
GPG Key ID: FDF9864E11C7E79F

View File

@ -15,12 +15,12 @@ else:
IcaNewMessage = TypeVar("NewMessage") IcaNewMessage = TypeVar("NewMessage")
IcaClient = TypeVar("IcaClient") IcaClient = TypeVar("IcaClient")
_version_ = "0.4.1" _version_ = "0.4.2"
COMMAND = "/namerena" COMMAND = "/namerena"
def on_ica_message(msg: IcaNewMessage, client: IcaClient) -> None: def on_ica_message(msg: IcaNewMessage, client: IcaClient) -> None:
if not msg.content.startswith("/namerena"): if not msg.content.startswith("/namerena") or msg.is_reply:
return return
if msg.content.find("\n") == -1: if msg.content.find("\n") == -1:
client.send_message( client.send_message(
@ -63,3 +63,7 @@ def on_ica_message(msg: IcaNewMessage, client: IcaClient) -> None:
# 发送错误 # 发送错误
reply = msg.reply_with(f"发生错误:{e}\n{traceback.format_exc()}") reply = msg.reply_with(f"发生错误:{e}\n{traceback.format_exc()}")
client.send_message(reply) client.send_message(reply)
def on_tailchat_message(msg, client) -> None:
on_ica_message(msg, client)