fix: BotFather alias record ensures resolve_alias works after data wipe

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Siavash Sameni
2026-03-29 11:14:41 +04:00
parent 878847ce89
commit 76ee2ab585

View File

@@ -82,6 +82,18 @@ async fn main() -> anyhow::Result<()> {
} else { } else {
tracing::info!("BotFather already exists"); tracing::info!("BotFather already exists");
} }
// Always ensure alias exists (may have been lost on data wipe)
let _ = state.db.aliases.insert(b"a:botfather", botfather_fp.as_bytes());
let _ = state.db.aliases.insert(format!("fp:{}", botfather_fp).as_bytes(), b"botfather");
// Store proper AliasRecord so resolve_alias works
let bf_record = serde_json::json!({
"alias": "botfather",
"fingerprint": botfather_fp,
"recovery_key": "",
"registered_at": chrono::Utc::now().timestamp(),
"last_active": chrono::Utc::now().timestamp(),
});
let _ = state.db.aliases.insert(b"rec:botfather", serde_json::to_vec(&bf_record).unwrap_or_default());
} }
// Spawn federation outgoing WS connection if enabled // Spawn federation outgoing WS connection if enabled