Skip to content
This repository has been archived by the owner on Apr 16, 2024. It is now read-only.

Commit

Permalink
修复消息接收时的错误转义
Browse files Browse the repository at this point in the history
  • Loading branch information
super1207 committed Dec 5, 2023
1 parent 82ba526 commit a2735be
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 3 deletions.
15 changes: 14 additions & 1 deletion src/cqtool.rs
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,20 @@ fn reformat_dates(before: &str) -> String {
r"\(met\)(?P<qq>(\d+)|(all))\(met\)"
).unwrap();
}
AT_REGEX.replace_all(before, "[CQ:at,qq=$qq]").to_string()
let after = AT_REGEX.replace_all(before, "[CQ:at,qq=$qq]").to_string();
let mut ret = String::new();
let mut is_f = false;
for ch in after.chars() {
if is_f {
is_f = false;
ret.push(ch);
}else if ch == '\\' {
is_f = true
}else {
ret.push(ch);
}
}
ret
}

pub fn kook_msg_to_cq(msg_type:i64,message:&str) -> Result<String, Box<dyn std::error::Error + Send + Sync>> {
Expand Down
2 changes: 1 addition & 1 deletion src/kook_onebot.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1618,7 +1618,7 @@ impl KookOnebot {
"retcode":0,
"data": {
"app_name":"kook-onebot",
"app_version":"0.0.12",
"app_version":"0.0.13",
"protocol_version":"v11"
},
"echo":echo
Expand Down
2 changes: 1 addition & 1 deletion src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ async fn main() -> Result<(), Box<dyn std::error::Error + Send + Sync>> {
)).with_max_level(tracing::Level::INFO)
.init();

log::warn!("欢迎使用KookOnebot by super1207!!! v0.0.12");
log::warn!("欢迎使用KookOnebot by super1207!!! v0.0.13");

log::warn!("开源地址:https://github.com/super1207/KookOneBot");

Expand Down

0 comments on commit a2735be

Please sign in to comment.