优化头像获取
This commit is contained in:
parent
5065e74e90
commit
940ede4c07
|
@ -443,7 +443,7 @@ export default class RoleIndex extends base {
|
|||
return this.roleExploreData(ret)
|
||||
}
|
||||
|
||||
roleExploreData(res) {
|
||||
async roleExploreData(res) {
|
||||
let [resIndex, basicInfo] = res
|
||||
|
||||
let stats = resIndex.stats
|
||||
|
@ -588,10 +588,12 @@ export default class RoleIndex extends base {
|
|||
explor.push(tmp)
|
||||
}
|
||||
|
||||
if (this.e.at)
|
||||
this.qq = this.e.at
|
||||
else
|
||||
this.qq = this.e.user_id
|
||||
let imgs = fs.readdirSync(`${this._path}/plugins/genshin/resources/img/role`).filter(file => file.endsWith('.png'))
|
||||
let avatar = lodash.sample(imgs)
|
||||
if (this.e.member?.getAvatarUrl)
|
||||
avatar = await this.e.member.getAvatarUrl()
|
||||
else if (this.e.friend?.getAvatarUrl)
|
||||
avatar = await this.e.friend.getAvatarUrl()
|
||||
|
||||
return {
|
||||
saveId: this.e.uid,
|
||||
|
@ -603,7 +605,7 @@ export default class RoleIndex extends base {
|
|||
headIndexStyle: this.headIndexStyle,
|
||||
...this.screenData,
|
||||
gamename: resIndex?.role?.nickname ?? 0,
|
||||
avatar: `https://q1.qlogo.cn/g?b=qq&s=0&nk=${this.qq}`,
|
||||
avatar,
|
||||
gameavatar: resIndex?.role?.avatar ?? 0,
|
||||
gamelevel: resIndex?.role?.level ?? 0,
|
||||
gamefwq: resIndex?.role?.region
|
||||
|
|
Loading…
Reference in New Issue