feat: 通知

This commit is contained in:
CrescentLeaf
2025-10-25 01:23:41 +08:00
parent 760e5a118a
commit d5e349ee88
4 changed files with 46 additions and 4 deletions

View File

@@ -1,5 +1,6 @@
import data from "../Data.ts"
import Client from "./Client.ts"
import Chat from "./client_data/Chat.ts"
import User from "./client_data/User.ts"
export default class DataCaches {
@@ -16,4 +17,20 @@ export default class DataCaches {
}
return this.userProfiles[userId] = (re.data as unknown as User)
}
static chatInfos: { [key: string]: Chat} = {}
static async getChatInfo(chatId: string): Promise<Chat> {
if (this.chatInfos[chatId]) return this.chatInfos[chatId]
const re = await Client.invoke('Chat.getInfo', {
token: data.access_token,
target: chatId,
})
if (re.code != 200) return {
id: '',
title: '',
type: '' as any,
is_admin: false,
is_member: false,
}
return this.chatInfos[chatId] = (re.data as unknown as Chat)
}
}