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