bugfix & command help

This commit is contained in:
Miyabi 2024-05-22 19:18:22 +08:00
parent 26b54248a6
commit 5cf7c4f6f7
3 changed files with 12 additions and 3 deletions

View file

@ -13,7 +13,16 @@ macro_rules! commands {
let input = command[1..].split(" ").collect::<Vec<&str>>(); let input = command[1..].split(" ").collect::<Vec<&str>>();
let (Some(category), Some(action)) = (input.get(0), input.get(1)) else { let (Some(category), Some(action)) = (input.get(0), input.get(1)) else {
return send_text(session, "Usage: /[category] [action] [arg1] [arg2] ...").await; let mut help_text = "Available Commands: ".to_string();
$(
help_text.push_str(stringify!($category));
help_text.push_str(" ");
help_text.push_str(stringify!($action));
help_text.push_str("; ");
)*
let _ = send_text(session, &help_text).await;
let _ = send_text(session, "Usage: /[category] [action] [arg1] [arg2] ...").await;
return send_text(session, "Type /[category] [action] to get more detailed help.").await;
}; };
let args = &input[2..]; let args = &input[2..];

View file

@ -1,7 +1,7 @@
{ {
"http_port": 21000, "http_port": 21000,
"dispatch_endpoint": "http://127.0.0.1:21041", "dispatch_endpoint": "http://127.0.0.1:21041",
"disable_password_check": false, "disable_password_check": true,
"database": { "database": {
"connection_string": "mongodb://127.0.0.1:27017", "connection_string": "mongodb://127.0.0.1:27017",
"name": "FireflySR", "name": "FireflySR",

View file

@ -54,7 +54,7 @@ async fn login(
Err(_) => return fail_json(-1, "Internal server error"), Err(_) => return fail_json(-1, "Internal server error"),
}; };
if CONFIGURATION.disable_password_check || util::verify_password(&password_opt.unwrap(), &account.account_password).is_err() { if !CONFIGURATION.disable_password_check && util::verify_password(&password_opt.unwrap(), &account.account_password).is_err() {
return fail_json(-101, "Account or password error"); return fail_json(-101, "Account or password error");
} }