Skip to content

Commit

Permalink
feat(app.plugin.group_qa): 支持取消添加/修改 Q&A
Browse files Browse the repository at this point in the history
  • Loading branch information
Colsrch committed Apr 3, 2023
1 parent 7451502 commit b7393e8
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
8 changes: 6 additions & 2 deletions app/plugin/basic/__07_group_qa/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,14 +40,18 @@ async def answer(user: Member, group: Group, msg: MessageChain):
return msg.display

qa = await get_config("group_qa", sender) or []
message("请在180秒内输入关键词").target(sender).quote(source).send()
message("请在180秒内输入关键词, 若关键词一致则修改相关回答内容, 发送 #取消# 取消添加/修改").target(sender).quote(source).send()
keyword = await DefaultFunctionWaiter(answer, [GroupMessage]).wait(180, "TimeoutError")
if keyword == "TimeoutError":
return message("等待超时!").target(sender).send()
message("很好! 接下来请在180秒内输入回答消息").target(sender).send()
elif keyword == "#取消#":
return message("已取消!").target(sender).send()
message("很好! 接下来请在180秒内输入回答消息, 发送 #取消# 取消添加/修改").target(sender).send()
msg = await DefaultFunctionWaiter(answer, [GroupMessage]).wait(180, "TimeoutError")
if msg == "TimeoutError":
return message("等待超时!").target(sender).send()
elif msg == "#取消#":
return message("已取消!").target(sender).send()
if cmd.find("startswith"):
pattern = "head"
elif cmd.find("endswith"):
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ ignore = [
line-length = 120

select = ["E", "F", "I", "UP", "C", "T", "Q"]
ignore = ["C901"]
ignore = ["C901", "E501"]

# Exclude a variety of commonly ignored directories.
extend-exclude = [
Expand Down

0 comments on commit b7393e8

Please sign in to comment.