chore: 补充所需要的方法
This commit is contained in:
@@ -231,7 +231,10 @@ export default class Chat {
|
||||
if (this.bean.type == 'group') return this.bean.avatar_file_hash
|
||||
if (this.bean.type == 'private') return this.getAnotherUserForPrivate(userMySelf as User)?.getAvatarFileHash()
|
||||
}
|
||||
setAvatarFileHash(hash: string) {
|
||||
this.setAttr("avatar_file_hash", hash)
|
||||
}
|
||||
async setAvatar(avatar: Buffer) {
|
||||
this.setAttr("avatar_file_hash", (await FileManager.uploadFile(`avatar_chat_${this.bean.count}`, avatar)).getHash())
|
||||
this.setAvatarFileHash((await FileManager.uploadFile(`avatar_chat_${this.bean.count}`, avatar)).getHash())
|
||||
}
|
||||
}
|
||||
|
||||
@@ -167,7 +167,10 @@ export default class User {
|
||||
getAvatarFileHash() {
|
||||
return this.bean.avatar_file_hash
|
||||
}
|
||||
setAvatarFileHash(hash: string) {
|
||||
this.setAttr("avatar_file_hash", hash)
|
||||
}
|
||||
async setAvatar(avatar: Buffer) {
|
||||
this.setAttr("avatar_file_hash", (await FileManager.uploadFile(`avatar_user_${this.bean.count}`, avatar)).getHash())
|
||||
this.setAvatarFileHash((await FileManager.uploadFile(`avatar_user_${this.bean.count}`, avatar)).getHash())
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user