Skip to content
This repository has been archived by the owner on Aug 26, 2020. It is now read-only.

自定义回复功能 #1

Open
wants to merge 6 commits into
base: master
Choose a base branch
from

Conversation

lunzhiPenxil
Copy link
Member

@lunzhiPenxil lunzhiPenxil commented Jul 3, 2020

可以在CoolQ的可执行文件目录下建立/LogData/CustomReply.json文件,通过编辑Json格式的文本自定义运行过程中的回复词。
相关回复词配置项的默认值如下,所需的json格式文件也如下所示:

{
    "self":"",
    "strAlreadyLogging":"正在进行日志记录, 无法再次开始!",
    "strStartLogging":"开始日志记录",
    "strStartSaveLog":"正在保存日志",
    "strSuccessSaveLog":"日志记录已结束,文件已保存,正在上传至服务器",
    "strFailSaveLog":"保存失败,您可以尝试稍后重试此命令再次保存\n错误信息:",
    "strSuccessUploadLogBefore":"上传已完成,请访问",
    "strSuccessUploadLogAfter":"以查看记录",
    "strFailUploadLog":"上传过程中发生错误,请联系管理员或稍后再次使用此命令重试上传\n错误信息:",
    "strNeverLog":"没有已开始的日志记录!",
    "strLogHlp":"\n.log     \t 启动日志记录\n.log stop\t 停止日志记录\n.log help\t 日志记录帮助"
}

其中"self"在缺省状态下将被初始化为本机昵称。

@w4123
Copy link
Member

w4123 commented Jul 3, 2020

  1. Dice里面用的nlohmann::json, 这里也改成这个吧
  2. 昵称里面包含{self}就会出问题……虽然一般大家都不会这么做

@w4123 w4123 added the enhancement New feature or request label Jul 3, 2020
@w4123 w4123 added this to the 1.1.0 milestone Jul 3, 2020
@w4123
Copy link
Member

w4123 commented Jul 3, 2020

并且_CRT_SECURE_NO_WARNINGS这种东西不应该存在的

std::stringstream CustomReplyJSONsstr;
CustomReplyJSONsstr << CustomReplyJSON.rdbuf();
neb::CJsonObject CustomReplyJSONobj(UTF8ToGBK(CustomReplyJSONsstr.str()));
for (auto &it : CustomReply)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

const?

@lunzhiPenxil
Copy link
Member Author

现在通过修改CustomReplyFilter来控制哪些自定义项目可以被作为替换内容,否则就可以被执行替换

@w4123
Copy link
Member

w4123 commented Jul 6, 2020

其实我没意料到你直接复制了Dice里面的……那个写的什么都不是
直接用nlohmann::json就够了……
不过先这样也行不必须改

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants