first commit
This commit is contained in:
@@ -0,0 +1,9 @@
|
||||
# 当前群人格
|
||||
|
||||
发送 `/切换人格 嘴臭`、`/切换人格 卑微`、`/切换人格 夸夸` 或 `/切换人格 取消`。
|
||||
|
||||
人格是一层表达风格,作用于当前群的模型对话、个人总结、全群总结和接龙点评。事实和接龙规则仍按任务要求处理。每个群单独保存,重启和清理聊天文本不会重置人格。
|
||||
|
||||
“嘴臭”使用短促、自信、直接的提示词,正文限制为二十个可见字符并使用纯文本;总结只给一句短评。其他人格遵循各自的表达要求,取消后恢复正常任务提示。
|
||||
|
||||
提示词位于 `wxbot_framework/personality.py`。新的公开副本没有任何预置的人格选择。
|
||||
@@ -0,0 +1,22 @@
|
||||
"""接收线程先切换,本插件负责显示确认。"""
|
||||
from wxbot_framework.members import SnapshotExpired
|
||||
from wxbot_framework.personality import switch_ack
|
||||
|
||||
|
||||
class Plugin:
|
||||
def on_load(self, ctx):
|
||||
self.members = ctx.members
|
||||
|
||||
def on_message(self, message, ctx):
|
||||
if not message.is_group or message.chat_id not in self.members.groups or message.type != 1:
|
||||
return
|
||||
if message.data.get("personality_error"):
|
||||
ctx.reply(message, message.data["personality_error"])
|
||||
state = message.data.get("personality_switch")
|
||||
if state is None:
|
||||
return
|
||||
try:
|
||||
ctx.reply(message, switch_ack(state.name), delivery_guard=lambda: ctx.personality_guard(state))
|
||||
ctx.logger.info("人格已切换:room=%s name=%s", state.room, state.name)
|
||||
except SnapshotExpired:
|
||||
pass
|
||||
@@ -0,0 +1,5 @@
|
||||
{
|
||||
"api": "v1",
|
||||
"description": "按群切换统一的嘴臭、卑微、夸夸人格",
|
||||
"requires": ["group.text.receive", "group.text.send"]
|
||||
}
|
||||
Reference in New Issue
Block a user