Skip to content

Commit

Permalink
godcmd: load clear_memory_commands
Browse files Browse the repository at this point in the history
  • Loading branch information
lanvent committed Apr 4, 2023
1 parent 28eb67b commit 186e18f
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
2 changes: 1 addition & 1 deletion config.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@
"wechaty_puppet_service_token": "", # wechaty的token

# chatgpt指令自定义触发词
"clear_memory_commands": ['#清除记忆'], # 重置会话指令
"clear_memory_commands": ['#清除记忆'], # 重置会话指令,必须以#开头

# channel配置
"channel_type": "wx", # 通道类型,支持wx,wxy和terminal
Expand Down
11 changes: 9 additions & 2 deletions plugins/godcmd/godcmd.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
from bridge.bridge import Bridge
from bridge.context import ContextType
from bridge.reply import Reply, ReplyType
from config import load_config
from config import conf, load_config
import plugins
from plugins import *
from common import const
Expand Down Expand Up @@ -126,7 +126,14 @@ def __init__(self):
else:
with open(config_path,"r") as f:
gconf=json.load(f)


custom_commands = conf().get("clear_memory_commands", [])
for custom_command in custom_commands:
if custom_command and custom_command.startswith("#"):
custom_command = custom_command[1:]
if custom_command and custom_command not in COMMANDS["reset"]["alias"]:
COMMANDS["reset"]["alias"].append(custom_command)

self.password = gconf["password"]
self.admin_users = gconf["admin_users"] # 预存的管理员账号,这些账号不需要认证 TODO: 用户名每次都会变,目前不可用
self.isrunning = True # 机器人是否运行中
Expand Down

0 comments on commit 186e18f

Please sign in to comment.