Files
LangBot/pkg/qqbot/cmds/session/resend.py

31 lines
945 B
Python
Raw Normal View History

2023-11-13 21:59:23 +08:00
from .. import aamgr
2023-11-13 21:59:23 +08:00
@aamgr.AbstractCommandNode.register(
parent=None,
name="resend",
description="重新获取上一次问题的回复",
usage="!resend",
aliases=[],
privilege=1
)
2023-11-13 21:59:23 +08:00
class ResendCommand(aamgr.AbstractCommandNode):
@classmethod
2023-11-13 21:59:23 +08:00
def process(cls, ctx: aamgr.Context) -> tuple[bool, list]:
from ....openai import session as openai_session
from ....utils import context
from ....qqbot import message
import config
session_name = ctx.session_name
reply = []
2023-11-13 21:59:23 +08:00
session = openai_session.get_session(session_name)
to_send = session.undo()
2023-11-13 21:59:23 +08:00
mgr = context.get_qqbot_manager()
2023-11-13 21:59:23 +08:00
reply = message.process_normal_message(to_send, mgr, config,
ctx.launcher_type, ctx.launcher_id,
ctx.sender_id)
return True, reply