Implement chats for birthday characters

This commit is contained in:
Ethan O'Brien
2024-06-03 16:57:28 -05:00
parent cec34b81ac
commit 1106ee89ba
10 changed files with 98 additions and 26 deletions

View File

@@ -20,6 +20,15 @@ pub fn add_chat(id: i64, num: i64, chats: &mut JsonValue) -> bool {
true
}
pub fn add_chat_from_chapter_id(chapter_id: i64, chats: &mut JsonValue) -> bool {
let chapter = &databases::CHAPTERS_MASTER[chapter_id.to_string()];
if chapter.is_empty() {
println!("Attempted to give unknown chapter id {}", chapter_id);
return false;
}
add_chat(chapter["masterChatId"].as_i64().unwrap(), chapter["roomId"].as_i64().unwrap(), chats)
}
pub fn home(req: HttpRequest, body: String) -> Option<JsonValue> {
let key = global::get_login(req.headers(), &body);
let chats = userdata::get_acc_chats(&key);