23 lines
663 B
Python
23 lines
663 B
Python
from core.command_manager import matcher
|
|
|
|
from ..core.ws import WS
|
|
from ..models.event import Event
|
|
|
|
|
|
# TODO 把该死的这些给抽象化
|
|
@matcher.command("echo")
|
|
async def handle_echo(bot: WS, event: Event, args: list[str]):
|
|
if not args:
|
|
reply_msg = "请在指令后输入要回复的内容,例如:/echo 你好"
|
|
else:
|
|
reply_msg = " ".join(args)
|
|
|
|
if event.message_type == "group":
|
|
await bot.call_api(
|
|
"send_group_msg", {"group_id": event.group_id, "message": reply_msg}
|
|
)
|
|
else:
|
|
await bot.call_api(
|
|
"send_private_msg", {"user_id": event.user_id, "message": reply_msg}
|
|
)
|