消息渠道的消息支持多语言

This commit is contained in:
xintaofei
2026-03-31 13:49:16 +08:00
parent f2a53acc9d
commit f06360a59d
24 changed files with 1319 additions and 102 deletions

View File

@@ -225,3 +225,24 @@ pub async fn set_chat_event_filter(
cc_commands::set_chat_event_filter_core(&state.db, params.filter).await?;
Ok(Json(()))
}
pub async fn get_chat_message_language(
Extension(state): Extension<Arc<AppState>>,
) -> Result<Json<String>, AppCommandError> {
let result = cc_commands::get_chat_message_language_core(&state.db).await?;
Ok(Json(result))
}
#[derive(Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct SetMessageLanguageParams {
pub language: String,
}
pub async fn set_chat_message_language(
Extension(state): Extension<Arc<AppState>>,
Json(params): Json<SetMessageLanguageParams>,
) -> Result<Json<()>, AppCommandError> {
cc_commands::set_chat_message_language_core(&state.db, params.language).await?;
Ok(Json(()))
}

View File

@@ -197,6 +197,8 @@ pub fn build_router(state: Arc<AppState>, token: String, static_dir: std::path::
.route("/set_chat_command_prefix", post(handlers::chat_channel::set_chat_command_prefix))
.route("/get_chat_event_filter", post(handlers::chat_channel::get_chat_event_filter))
.route("/set_chat_event_filter", post(handlers::chat_channel::set_chat_event_filter))
.route("/get_chat_message_language", post(handlers::chat_channel::get_chat_message_language))
.route("/set_chat_message_language", post(handlers::chat_channel::set_chat_message_language))
// ─── Terminal ───
.route("/terminal_spawn", post(handlers::terminal::terminal_spawn))
.route("/terminal_write", post(handlers::terminal::terminal_write))