refactor!: rewrite bot core; add AI (Ollama, Gemini), DB, new commands

This commit is contained in:
2026-01-12 15:32:50 +03:00
parent 9d74ad9861
commit df9471a7e4
137 changed files with 11341 additions and 2025 deletions
+38
View File
@@ -0,0 +1,38 @@
import {User} from "typescript-telegram-bot-api";
import {userDao} from "../index";
import {StoredUser} from "../model/stored-user";
export class UserStore {
private static map = new Map<number, StoredUser>();
static all(): Map<number, StoredUser> {
return this.map;
}
static async put(u: User) {
const user: StoredUser = {
id: u.id,
isBot: u.is_bot,
firstName: u.first_name,
lastName: u.last_name,
userName: u.username,
isPremium: u.is_premium,
};
this.map.set(u.id, user);
await userDao.insert(userDao.mapTo([u]));
}
static async get(id: number): Promise<StoredUser | null> {
const user = await userDao.getById({id: id});
if (!user) return null;
this.map.set(id, user);
return user;
}
static clear() {
this.map.clear();
}
}