feat: 通知
This commit is contained in:
@@ -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)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user