diff --git a/CHANGELOG.md b/CHANGELOG.md index 3ae15d93..b1a792d6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,4 +1,9 @@ -# 2.0 Alpha.5 +# 2.0 Alpha.6 + +* 一些已知Bug修复 +* `#面板练度统计` 样式微调 + +# 2.0 Alpha.1~5 * `#面板练度统计` 功能调整 * 在未绑定CK时,使用本地面板数据展示练度信息 @@ -6,10 +11,6 @@ * 重写角色数据获取逻辑,可能会导致一些角色信息类的查询异常,如遇问题请反馈 * `#刻晴`、`#老婆`等命令获取角色数据会使用本地面板数据做兜底 * MysApi内部逻辑重写 -* 一些已知Bug修复 - -# 2.0 Alpha.1~4 - * 重写`#刻晴`的角色卡片样式 * `#妮露天赋` 样式微调 * `#深渊配队`、`#戳一戳` 适配V3 diff --git a/README.md b/README.md index 1c29279a..9f8b9c8b 100644 --- a/README.md +++ b/README.md @@ -61,11 +61,11 @@ V2-Yunzai在较长一段时间内会维持更新,进行一些Bugfix及更新 ### #更新面板 -`#更新面板` 依赖于面板查询API,面板服务由 http://enka.shinshin.moe/ 提供 +`#更新面板` 依赖于面板查询API,面板服务由 http://enka.network/ 提供 查询功能经Enka官方授权([issue#63](https://github.com/yoimiya-kokomi/miao-plugin/issues/63#issuecomment-1199348789)),感谢Enka提供的面板查询服务 -如果可以的话,也请在Patreon上支持Enka,或提供闲置的原神账户,具体可在[Enka官网](http://enka.shinshin.moe/) Discord联系 +如果可以的话,也请在Patreon上支持Enka,或提供闲置的原神账户,具体可在[Enka官网](http://enka.network/) Discord联系 [issue#63](https://github.com/yoimiya-kokomi/miao-plugin/issues/63#issuecomment-1199734496) : 国内网络如Enka服务访问不稳定,可尝试更换 [@MiniGrayGay](https://github.com/MiniGrayGay) 大佬提供的中转服务 复制`config/profile_default.js` diff --git a/apps/character/avatar-card.js b/apps/character/avatar-card.js index bacf41dd..1755128f 100644 --- a/apps/character/avatar-card.js +++ b/apps/character/avatar-card.js @@ -76,7 +76,7 @@ async function renderCard (e, ds, renderType = 'card') { mode: bg.mode, custom, data - }, { e, scale: 1.1, retMsgId: true }) + }, { e, scale: 1.4, retMsgId: true }) if (msgRes && msgRes.message_id) { // 如果消息发送成功,就将message_id和图片路径存起来,1小时过期 await redis.set(`miao:original-picture:${msgRes.message_id}`, bg.img, { EX: 3600 }) diff --git a/apps/character/character-img-upload.js b/apps/character/character-img-upload.js index 60744db3..136a6ef7 100644 --- a/apps/character/character-img-upload.js +++ b/apps/character/character-img-upload.js @@ -39,7 +39,7 @@ export async function uploadCharacterImg (e) { // 支持at图片添加,以及支持后发送 source = (await e.group.getChatHistory(e.source?.seq, 1)).pop() } else { - source = (await e.friend.getChatHistory(e.source?.time, 1)).pop() + source = (await e.friend.getChatHistory((e.source?.time + 1), 1)).pop() } if (source) { for (let val of source.message) { @@ -50,7 +50,7 @@ export async function uploadCharacterImg (e) { } if (imageMessages.length <= 0) { - e.reply('消息中未找到图片,请将要发送的图片与消息一同发送..') + e.reply('消息中未找到图片,请将要发送的图片与消息一同发送或引用要添加的图像..') return true } await saveImages(e, name, imageMessages) @@ -67,7 +67,12 @@ async function saveImages (e, name, imageMessages) { } let senderName = lodash.truncate(e.sender.card, { length: 8 }) let imgCount = 0 + let urlMap = {} for (let val of imageMessages) { + if (!val.url || urlMap[val.url]) { + continue + } + urlMap[val.url] = true const response = await fetch(val.url) if (!response.ok) { e.reply('图片下载失败。') @@ -96,8 +101,7 @@ async function saveImages (e, name, imageMessages) { console.log('unlink', err) }) } - fs.rename(imgPath, newImgPath, (err) => { - console.log('rename', err) + fs.rename(imgPath, newImgPath, () => { }) imgCount++ Bot.logger.mark(`添加成功: ${path}/${fileName}`) diff --git a/apps/character/profile-common.js b/apps/character/profile-common.js index 8591c03f..9b038848 100644 --- a/apps/character/profile-common.js +++ b/apps/character/profile-common.js @@ -30,13 +30,13 @@ export async function getTargetUid (e) { return nc.uid } } - uid = await redis.get(`genshin:id-uid:${qq}`) || await redis.get(`genshin:uid:${qq}`) + uid = await redis.get(`genshin:id-uid:${qq}`) || await redis.get(`Yz:genshin:mys:qq-uid:${qq}`) if (uid && uidReg.test(uid)) { return uid } } if (!Version.isV3) { - let botQQ = global.BotConfig ? global.BotConfig.account.qq : false + let botQQ = global?.Bot?.uin || global?.BotConfig?.account?.qq if (e.at && e.at !== botQQ) { uid = await getUid(e.at) if (uid) { diff --git a/apps/character/profile-stat.js b/apps/character/profile-stat.js index 0776eaf7..8f276843 100644 --- a/apps/character/profile-stat.js +++ b/apps/character/profile-stat.js @@ -36,7 +36,7 @@ export async function profileStat (e) { avatarRet = lodash.orderBy(avatarRet, sortKey) avatarRet = avatarRet.reverse() let talentNotice = '' - if (!avatars.isSelfCookie) { + if (!avatars.isSelfCookie || avatarRet.length <= 8) { talentNotice = '未绑定CK,信息可能展示不完全。回复#体力帮助获取CK配置帮助' } diff --git a/components/Data.js b/components/Data.js index cd9204c1..3fdafb03 100644 --- a/components/Data.js +++ b/components/Data.js @@ -194,6 +194,8 @@ let Data = { if (lodash.isString(arr)) { arr = arr.replace(/\s*(;|;|、|,)\s*/, ',') arr = arr.split(',') + } else if (lodash.isNumber(arr)) { + arr = [arr.toString()] } lodash.forEach(arr, (str, idx) => { if (!lodash.isUndefined(str)) { diff --git a/models/Avatar.js b/models/Avatar.js index 33862ad1..b637c57f 100644 --- a/models/Avatar.js +++ b/models/Avatar.js @@ -153,7 +153,7 @@ export default class Avatar extends Base { } } } - let ret = char.getAvatarTalent(talent, avatar.cons, 'original') + let ret = char.getAvatarTalent(talent, this.cons, 'original') ret.id = id return ret } diff --git a/models/ProfileArtis.js b/models/ProfileArtis.js index 81f21995..20767bfd 100644 --- a/models/ProfileArtis.js +++ b/models/ProfileArtis.js @@ -191,6 +191,7 @@ export default class ProfileArtis extends Base { attrs, classTitle: title, weight: attrWeight, + // 待删除 mark: lodash.mapValues(attrs, (ds) => ds.mark), maxMark } diff --git a/models/User.js b/models/User.js index 79530503..3ef4fa1e 100644 --- a/models/User.js +++ b/models/User.js @@ -13,10 +13,14 @@ class User extends Base { // 初始化用户 constructor (cfg) { super() + if (!cfg.id) { + return false + } let self = this._getCache(`user:${cfg.id}`) if (!self) { self = this } + self.id = cfg.id self.uid = cfg.uid || self.uid || '' self.ck = cfg.ck || cfg.cookie || self.ck || '' return self._cache() diff --git a/resources/character/character-card.html b/resources/character/character-card.html index fd391fbe..6f1216ac 100644 --- a/resources/character/character-card.html +++ b/resources/character/character-card.html @@ -12,7 +12,7 @@