同步 TRSS-Yunzai 消息按钮

仅同步,无法显示
This commit is contained in:
🌌 2023-12-22 22:56:11 +08:00
parent 2a467c9f89
commit 39791196ed
17 changed files with 245 additions and 128 deletions

View File

@ -166,4 +166,4 @@ export class abbrSet extends plugin {
await this.e.reply(msg)
}
}
}

View File

@ -29,6 +29,4 @@ export class dailyNote extends plugin {
/** 生成图片 */
this.renderImg('genshin', `html/player/daily-note-${data.game}`, data)
}
}
}

View File

@ -63,13 +63,14 @@ export class exchange extends plugin {
for (let val of code.data.code_list) {
if (val.code) {
codes.push(val.code)
codes.push([val.code, segment.button([
{ text: "兑换", callback: `#兑换码使用${val.code}` },
])])
}
}
let msg = [`${title}-直播兑换码`, `兑换码过期时间: \n${this.deadline}`, ...codes]
msg = await common.makeForwardMsg(this.e, msg, msg[0])
let msg = [`兑换码过期时间: \n${this.deadline}`, ...codes]
msg = await common.makeForwardMsg(this.e, msg, `${title}-直播兑换码`)
await this.reply(msg)
}
@ -131,4 +132,4 @@ export class exchange extends plugin {
this.e.reply(`${res.data.msg}`)
}
}
}
}

View File

@ -50,6 +50,17 @@ export class gcLog extends plugin {
})
this.androidUrl = 'https://docs.qq.com/doc/DUWpYaXlvSklmVXlX'
this.prefix = this.e?.isSr ? "*" : "#"
this.button = segment.button([
{ text: "角色记录", callback: `${this.prefix}角色记录` },
{ text: "角色统计", callback: `${this.prefix}角色统计` },
],[
{ text: "武器记录", callback: `${this.prefix}武器记录` },
{ text: "武器统计", callback: `${this.prefix}武器统计` },
],[
{ text: "常驻记录", callback: `${this.prefix}常驻记录` },
{ text: "常驻统计", callback: `${this.prefix}常驻统计` },
])
}
async init () {
@ -111,7 +122,7 @@ export class gcLog extends plugin {
if (typeof data != 'object') return
await this.renderImg('genshin', `html/gacha/gacha-log`, data)
this.reply([await this.renderImg('genshin', `html/gacha/gacha-log`, data, { retType: "base64" }), this.button])
}
/** #抽卡记录 */
@ -123,7 +134,7 @@ export class gcLog extends plugin {
if (this.e.isAll) {
name = `html/gacha/gacha-all-log`
}
await this.renderImg('genshin', name, data)
this.reply([await this.renderImg('genshin', name, data, { retType: "base64" }), this.button])
}
/** 导出记录 */
@ -152,7 +163,11 @@ export class gcLog extends plugin {
}
async help () {
await this.e.reply(segment.image(`file://${_path}/resources/logHelp/记录帮助.png`))
await this.e.reply([segment.image(`file://${_path}/resources/logHelp/记录帮助.png`), segment.button([
{ text: "电脑", callback: "#电脑帮助" },
{ text: "安卓", callback: "#安卓帮助" },
{ text: "苹果", callback: "#苹果帮助" },
])])
}
async helpPort () {
@ -170,6 +185,7 @@ export class gcLog extends plugin {
async logCount () {
let data = await new LogCount(this.e).count()
if (!data) return
this.renderImg('genshin', `html/gacha/log-count`, data)
this.reply([await this.renderImg('genshin', `html/gacha/log-count`, data, { retType: "base64" }), this.button])
}
}

View File

@ -30,6 +30,12 @@ export class ledger extends plugin {
}
]
})
this.prefix = this.e?.isSr ? "*星琼" : "#原石"
this.button = segment.button([
{ text: "记录", callback: this.prefix },
{ text: "统计", callback: `${this.prefix}统计` },
])
}
async init () {
@ -47,7 +53,7 @@ export class ledger extends plugin {
if (!data) return
/** 生成图片 */
this.renderImg('genshin', `html/ledger/ledger-${data.game}`, data)
this.reply([await this.renderImg('genshin', `html/ledger/ledger-${data.game}`, data, { retType: "base64" }), this.button])
}
/** 原石任务 */
@ -61,7 +67,7 @@ export class ledger extends plugin {
if (!data) return
/** 生成图片 */
this.renderImg('genshin', `html/ledger/ledger-count-${data.game}`, data)
this.reply([await this.renderImg('genshin', `html/ledger/ledger-count-${data.game}`, data, { retType: "base64" }), this.button])
}
async ledgerCountHistory () {
@ -69,6 +75,6 @@ export class ledger extends plugin {
if (!data) return
/** 生成图片 */
this.renderImg('genshin', `html/ledger/ledger-count-${data.game}`, data)
this.reply([await this.renderImg('genshin', `html/ledger/ledger-count-${data.game}`, data, { retType: "base64" }), this.button])
}
}

View File

@ -138,10 +138,16 @@ export class payLog extends plugin {
}
return true
} else {
this.reply('请私聊发送米游社链接,可以发送【#充值统计帮助】查看链接教程', false)
this.reply(['请私聊发送米游社链接,可以发送【#充值统计帮助】查看链接教程',
segment.button([
{ text: "充值帮助", callback: "#充值统计帮助" },
])])
}
} else {
this.reply('请私聊发送米游社链接,可以发送【#充值统计帮助】查看链接教程', false)
this.reply(['请私聊发送米游社链接,可以发送【#充值统计帮助】查看链接教程',
segment.button([
{ text: "充值帮助", callback: "#充值统计帮助" },
])])
}
return true
}

View File

@ -29,6 +29,14 @@ export class role extends plugin {
fnc: 'roleExplore'
}]
})
this.prefix = this.e?.isSr ? "*" : "#"
this.button = segment.button([
{ text: "角色", callback: `${this.prefix}角色` },
{ text: "探索", callback: `${this.prefix}探索` },
{ text: "武器", callback: `${this.prefix}武器` },
{ text: "深渊", callback: `${this.prefix}深渊` },
])
}
/** 初始化配置文件 */
@ -69,7 +77,7 @@ export class role extends plugin {
console.log('abyss', data)
if (!data) return
this.renderImg('genshin', 'html/abyss/abyss', data)
this.reply([await this.renderImg('genshin', 'html/abyss/abyss', data, { retType: "base64" }), this.button])
}
/** 深渊十二层 */
@ -77,7 +85,7 @@ export class role extends plugin {
let data = await new Abyss(this.e).getAbyssFloor()
if (!data) return
await this.renderImg('genshin', 'html/abyss/abyss-floor', data)
this.reply([await this.renderImg('genshin', 'html/abyss/abyss-floor', data, { retType: "base64" }), this.button])
}
/** 武器 */
@ -85,7 +93,7 @@ export class role extends plugin {
let data = await Weapon.get(this.e)
if (!data) return
await this.renderImg('genshin', 'html/avatar/weapon', data)
this.reply([await this.renderImg('genshin', 'html/avatar/weapon', data, { retType: "base64" }), this.button])
}
/** 角色卡片 */
@ -93,7 +101,7 @@ export class role extends plugin {
let data = await new RoleIndex(this.e).roleCard()
if (!data) return
await this.renderImg('genshin', 'html/player/role-card', data)
this.reply([await this.renderImg('genshin', 'html/player/role-card', data, { retType: "base64" }), this.button])
}
/** 探险 */
@ -101,6 +109,6 @@ export class role extends plugin {
let data = await new RoleIndex(this.e).roleExplore()
if (!data) return
this.renderImg('genshin', 'html/player/role-explore', data)
this.reply([await this.renderImg('genshin', 'html/player/role-explore', data, { retType: "base64" }), this.button])
}
}

View File

@ -20,6 +20,12 @@ export class sevenSaints extends plugin {
}
]
})
this.button = segment.button([
{ text: "牌组", callback: `#七圣召唤查询牌组` },
{ text: "角色牌", callback: `#七圣召唤查询角色牌` },
{ text: "行动牌", callback: `#七圣召唤查询行动牌` },
])
}
async deckIndex() {
@ -36,7 +42,7 @@ export class sevenSaints extends plugin {
if (!data) return
let img = await puppeteer.screenshot('deck', data)
if (img) await this.reply(img)
if (img) await this.reply([img, this.button])
}
async deck_list(id = 0) {
@ -44,7 +50,7 @@ export class sevenSaints extends plugin {
if (!data) return
let img = await puppeteer.screenshot('deckList', data)
if (img) await this.reply(img)
if (img) await this.reply([img, this.button])
}
async deck_cards(id = 0) {
if (this.e.msg.includes('角色')) id = 1
@ -54,6 +60,6 @@ export class sevenSaints extends plugin {
if (!data) return
let img = await puppeteer.screenshot('deckCard', data)
if (img) await this.reply(img)
if (img) await this.reply([img, this.button])
}
}

View File

@ -13,6 +13,9 @@ gsCfg.cpCfg('mys', 'set')
* 1.增加多个来源的攻略图
* 2.优化获取攻略图逻辑更改为对比图片大小来寻找
* 3.增加攻略说明设置默认攻略功能
*
* 从拓展插件更新
* 作者曉K 更新🌌
*/
export class strategy extends plugin {
@ -24,7 +27,7 @@ export class strategy extends plugin {
priority: 50,
rule: [
{
reg: '^#?(更新)?\\S+攻略([1-4])?$',
reg: '^#?(更新)?\\S+攻略([1-7])?$',
fnc: 'strategy'
},
{
@ -32,7 +35,7 @@ export class strategy extends plugin {
fnc: 'strategy_help'
},
{
reg: '^#?设置默认攻略([1-4])?$',
reg: '^#?设置默认攻略([1-7])?$',
fnc: 'strategy_setting'
}
]
@ -52,10 +55,16 @@ export class strategy extends plugin {
// 来源:派蒙喵喵屋
[341284],
// 来源OH是姜姜呀(需特殊处理)
[341523]
[341523],
// 来源曉K → 废物一个
[1582613],
// 来源:坤易
[22148],
// 来源:婧枫赛赛
[1812949]
]
this.source = ['西风驿站', '原神观测枢', '派蒙喵喵屋', 'OH是姜姜呀']
this.source = ['西风驿站', '原神观测枢', '派蒙喵喵屋', 'OH是姜姜呀', '曉K', '坤易', '婧枫赛赛']
this.oss = '?x-oss-process=image//resize,s_1200/quality,q_90/auto-orient,0/interlace,1/format,jpg'
}
@ -66,7 +75,7 @@ export class strategy extends plugin {
fs.mkdirSync(this.path)
}
/** 初始化子目录 */
for (let subId of [1, 2, 3, 4]) {
for (let subId of [1, 2, 3, 4, 5, 6, 7]) {
let path = this.path + '/' + subId
if (!fs.existsSync(path)) {
fs.mkdirSync(path)
@ -76,7 +85,7 @@ export class strategy extends plugin {
/** #心海攻略 */
async strategy () {
let match = /^#?(更新)?(\S+)攻略([1-4])?$/.exec(this.e.msg)
let match = /^#?(更新)?(\S+)攻略([1-7])?$/.exec(this.e.msg)
// let isUpdate = !!this.e.msg.includes('更新')
let isUpdate = !!match[1]
@ -104,33 +113,37 @@ export class strategy extends plugin {
}
this.sfPath = `${this.path}/${group}/${role.name}.jpg`
let button = []
for (const i of [1, 2, 3, 4, 5, 6, 7])
button.push({ text: String(i), callback: `#${role.name}攻略${i}` })
button = segment.button(button)
if (fs.existsSync(this.sfPath) && !isUpdate) {
await this.e.reply(segment.image(`file://${this.sfPath}`))
await this.e.reply([segment.image(`file://${this.sfPath}`), button])
return
}
if (await this.getImg(role.name, group)) {
await this.e.reply(segment.image(`file://${this.sfPath}`))
await this.e.reply([segment.image(`file://${this.sfPath}`), button])
}
}
/** #攻略帮助 */
async strategy_help () {
await this.e.reply('攻略帮助:\n#心海攻略[1234]\n#更新早柚攻略[1234]\n#设置默认攻略[1234]\n示例: 心海攻略4\n\n攻略来源:\n1——西风驿站\n2——原神观测枢\n3——派蒙喵喵屋\n4——OH是姜姜呀')
await this.e.reply('攻略帮助:\n#心海攻略[1234567]\n#更新早柚攻略[1234567]\n#设置默认攻略[1234567]\n示例: 心海攻略4\n\n攻略来源:\n1——西风驿站\n2——原神观测枢\n3——派蒙喵喵屋\n4——OH是姜姜呀\n5——曉K\n6——坤易\n7——婧枫赛赛(角色配队一图流)')
}
/** #设置默认攻略1 */
async strategy_setting () {
let match = /^#?设置默认攻略([1-4])?$/.exec(this.e.msg)
let match = /^#?设置默认攻略([1-7])?$/.exec(this.e.msg)
let set = './plugins/genshin/config/mys.set.yaml'
let config = fs.readFileSync(set, 'utf8')
let num = Number(match[1])
if(isNaN(num)) {
await this.e.reply('默认攻略设置方式为: \n#设置默认攻略[1234] \n 请增加数字1-4其中一个')
await this.e.reply('默认攻略设置方式为: \n#设置默认攻略[1234567] \n 请增加数字1-7其中一个')
return
}
config = config.replace(/defaultSource: [1-4]/g, 'defaultSource: ' + num)
config = config.replace(/defaultSource: [1-7]/g, 'defaultSource: ' + num)
fs.writeFileSync(set, config, 'utf8')
await this.e.reply('默认攻略已设置为: ' + match[1])
@ -203,4 +216,4 @@ export class strategy extends plugin {
const res = await response.json()
return res
}
}
}

View File

@ -16,6 +16,9 @@ export class takeBirthdayPhoto extends plugin {
}
]
})
this.button = segment.button([
{ text: "留影叙佳期", input: "#留影叙佳期" },
])
}
async birthdaystar(e) {
@ -23,24 +26,26 @@ export class takeBirthdayPhoto extends plugin {
const userInfo = await this.getCookie(user_id)
if (!userInfo) {
e.reply('请先绑定ck再使用本功能哦~', true)
e.reply(['请先绑定ck再使用本功能哦~', segment.button([
{ text: "Cookie帮助", callback: "#Cookie帮助" },
])], true)
return true
}
const e_hk4e_token = await this.getEHK4EToken(userInfo.ck, userInfo.uid)
if (!e_hk4e_token) {
e.reply('获取e-hk4e_token失败请刷新ck后再试~', true)
e.reply(['获取e-hk4e_token失败请刷新ck后再试~', this.button], true)
return true
}
const birthday_star_list = await this.getBirthdayStar(userInfo.uid, e_hk4e_token, userInfo.ck)
if (!birthday_star_list) {
e.reply('获取生日角色失败,请稍后再试~', true)
e.reply(['获取生日角色失败,请稍后再试~', this.button], true)
return true
}
if (birthday_star_list.length === 0) {
e.reply('今天没有生日角色哦~', true)
e.reply(['今天没有生日角色哦~', this.button], true)
return true
}
try {
@ -49,14 +54,14 @@ export class takeBirthdayPhoto extends plugin {
await e.reply(segment.image(role.take_picture))
const message = await this.getBirthdayStarImg(userInfo.uid, e_hk4e_token, userInfo.ck, role.role_id)
if (message != 'success') {
await e.reply(message)
await e.reply([message, this.button])
return true
} else {
await e.reply(`获取${role.name}的图片成功~`, true)
}
}
} catch (error) {
await e.reply(`获取角色留影叙佳期图片失败可能是ck失效...`, true)
await e.reply([`获取角色留影叙佳期图片失败可能是ck失效...`, this.button], true)
logger.error(error)
}

View File

@ -12,15 +12,15 @@ export class user extends plugin {
priority: 300,
rule: [
{
reg: '^#*(体力|ck|cookie)帮助',
reg: '^#?(体力|[Cc](oo)?[Kk](ie)?)帮助',
fnc: 'ckHelp'
},
{
reg: '^(ck|cookie|js)代码$',
reg: '^#[Cc](oo)?[Kk](ie)?代码$',
fnc: 'ckCode'
},
{
reg: '^#绑定(cookie|ck)$',
reg: '^#绑定[Cc](oo)?[Kk](ie)?$',
fnc: 'bingCk'
},
{
@ -29,12 +29,12 @@ export class user extends plugin {
fnc: 'noLogin'
},
{
reg: '^#?(原神|星铁)?我的(ck|cookie)$',
reg: '^#?(原神|星铁)?我的[Cc](oo)?[Kk](ie)?$',
event: 'message',
fnc: 'myCk'
},
{
reg: '^#?(原神|星铁)?删除(ck|cookie)$',
reg: '^#?(原神|星铁)?删除[Cc](oo)?[Kk](ie)?$',
fnc: 'delCk'
},
{
@ -50,7 +50,7 @@ export class user extends plugin {
fnc: 'showUid'
},
{
reg: '^#\\s*(检查|我的)*ck(状态)*$',
reg: '^#\\s*(检查|我的)*[Cc](oo)?[Kk](ie)?(状态)*$',
fnc: 'checkCkStatus'
},
{
@ -77,11 +77,11 @@ export class user extends plugin {
// 由于手机端米游社网页可能获取不到ltuid 可以尝试在通行证页面获取login_uid
if (/(ltoken|ltoken_v2)/.test(this.e.msg) && /(ltuid|login_uid|ltmid_v2)/.test(this.e.msg)) {
if (this.e.isGroup) {
this.reply('请私聊发送cookie', false, { at: true })
this.reply('请私聊发送Cookie', false, { at: true })
return true
}
this.e.ck = this.e.msg
this.e.msg = '#绑定cookie'
this.e.msg = '#绑定Cookie'
return true
}
@ -107,7 +107,7 @@ export class user extends plugin {
/** 未登录ck */
async noLogin () {
this.reply('绑定cookie失败\n请先【登录米游社】或【登录通行证】再获取cookie')
this.reply('绑定Cookie失败\n请先【登录米游社】或【登录通行证】再获取Cookie')
}
/** #ck代码 */
@ -118,7 +118,7 @@ export class user extends plugin {
/** ck帮助 */
async ckHelp () {
let set = gsCfg.getConfig('mys', 'set')
await this.reply(`Cookie绑定配置教程${set.cookieDoc}\n获取cookie后【私聊发送】进行绑定`)
await this.reply(`Cookie绑定配置教程${set.cookieDoc}\n获取Cookie后【私聊发送】进行绑定`)
}
/** 绑定ck */
@ -126,7 +126,7 @@ export class user extends plugin {
let set = gsCfg.getConfig('mys', 'set')
if (!this.e.ck) {
await this.reply(`请【私聊】发送米游社cookie获取教程\n${set.cookieDoc}`)
await this.reply(`请【私聊】发送米游社Cookie获取教程\n${set.cookieDoc}`)
return
}
@ -187,4 +187,4 @@ export class user extends plugin {
async bindNoteUser () {
await this.User.bindNoteUser()
}
}
}

View File

@ -12,54 +12,47 @@ export class user extends plugin {
priority: 300,
rule: [{
reg: '^#用户统计$',
fnc: 'userAdmin'
fnc: 'userAdmin',
permission: "master",
}, {
reg: '^#(刷新|重置)用户(缓存|统计|ck|Ck|CK)$',
fnc: 'resetCache'
fnc: 'resetCache',
permission: "master",
}, {
reg: '^#删除(无效|失效)(用户|ck|Ck|CK)$',
fnc: 'delDisable'
fnc: 'delDisable',
permission: "master",
}]
})
this.User = new User(e)
}
checkAuth () {
if (!this.e.isMaster) {
this.e.reply('只有管理员可用...')
return false
}
return true
this.button = segment.button([
{ text: "用户统计", callback: "#用户统计" },
{ text: "删除无效", callback: "#删除无效用户" },
],[
{ text: "刷新统计", callback: "#刷新用户统计" },
{ text: "重置统计", callback: "#重置用户统计" },
])
}
/** #用户统计$ */
async userAdmin () {
if (!this.checkAuth()) {
return true
}
let data = await new User(this.e).userAdmin()
if (!data) return true
/** 生成图片 */
this.renderImg('genshin', 'html/admin/userAdmin', data)
this.reply([await this.renderImg('genshin', 'html/admin/userAdmin', data, { retType: "base64" }), this.button])
}
/** #刷新用户缓存 / #重置用户缓存 */
async resetCache () {
if (!this.checkAuth()) {
return true
}
// 清空老数据
const clearData = /重置/.test(this.e.msg)
await MysInfo.initCache(true, clearData)
this.e.reply(`用户缓存已${clearData ? '重置' : '刷新'}...\n通过【#用户统计】命令可查看详情`)
this.reply([`用户缓存已${clearData ? '重置' : '刷新'}...\n通过【#用户统计】命令可查看详情`, this.button])
}
async delDisable () {
if (!this.checkAuth()) {
return true
}
let count = await MysInfo.delDisable()
this.e.reply(count > 0 ? `已删除${count}个无效用户` : '暂无无效用户...')
this.reply([count > 0 ? `已删除${count}个无效用户` : '暂无无效用户...', this.button])
}
}

View File

@ -70,7 +70,7 @@ export default class ExportLog extends base {
lang: list[0].lang,
export_time: moment().format('YYYY-MM-DD HH:mm:ss'),
export_timestamp: moment().format('X'),
export_app: 'Miao-Yunzai',
export_app: 'TRSS-Yunzai',
export_app_version: cfg.package.version,
},
list

View File

@ -310,7 +310,11 @@ export default class Ledger extends base {
}
// console.log(NoteData)
if (!NoteData || lodash.isEmpty(NoteData)) {
this.e.reply(`${this.e?.isSr ? '暂无星琼数据,请先发送 *星琼' : '暂无原石数据,请先发送 #原石'}`, false, { at: true })
this.e.reply(this.e?.isSr ? ['暂无星琼数据,请先发送 *星琼', segment.button([
{ text: "星琼", input: "*星琼" },
])] : ['暂无原石数据,请先发送 #原石', segment.button([
{ text: "原石", input: "#原石" },
])], false, { at: true })
return false
}
NoteData = NoteData[nowYear]

View File

@ -6,7 +6,7 @@ import MysUser from './MysUser.js'
import DailyCache from './DailyCache.js'
export default class MysInfo {
static tips = '请先#绑定cookie\n发送【体力帮助】查看配置教程'
static tips = '请先#绑定Cookie\n发送【Cookie帮助】查看配置教程'
constructor (e) {
if (e) {
@ -28,6 +28,9 @@ export default class MysInfo {
this.auth = ['dailyNote', 'bbs_sign_info', 'bbs_sign_home', 'bbs_sign', 'ys_ledger', 'compute', 'avatarSkill', 'detail', 'blueprint', 'UserGame', 'deckList', 'avatar_cardList', 'action_cardList', 'avatarInfo']
this.gtest = false
this.mysButton = segment.button([
{ text: "米游社", link: "https://miyoushe.com" },
])
}
static async init (e, api) {
@ -93,7 +96,9 @@ export default class MysInfo {
let atUser = await NoteUser.create(at)
uid = atUser.getUid(e)
if (uid) return String(uid)
if (e.noTips !== true) e.reply('尚未绑定uid', false, { at })
if (e.noTips !== true) e.reply(['尚未绑定uid', segment.button([
{ text: "绑定UID", input: "#绑定uid" },
])], false, { at })
return false
}
@ -111,7 +116,9 @@ export default class MysInfo {
return user.autoRegUid(uid, e)
}
if (e.noTips !== true) e.reply('请先#绑定uid', false, { at })
if (e.noTips !== true) e.reply(['请先#绑定uid', segment.button([
{ text: "绑定UID", input: "#绑定uid" },
])], false, { at })
return false
}
@ -129,7 +136,9 @@ export default class MysInfo {
let selfUser = at ? await NoteUser.create(at) : user
if (!selfUser.hasCk) {
if (e.noTips !== true) e.reply('尚未绑定cookie', false, { at: selfUser.qq })
if (e.noTips !== true) e.reply(['尚未绑定Cookie', segment.button([
{ text: "Cookie帮助", callback: "#Cookie帮助" },
])], false, { at: selfUser.qq })
return false
}
@ -304,11 +313,15 @@ export default class MysInfo {
if (this.e.noTips === true) return
if (!this.uid) {
this.e.reply('请先#绑定uid')
this.e.reply(['请先#绑定uid', segment.button([
{ text: "绑定UID", input: "#绑定uid" },
])])
}
if (!this.ckInfo.ck) {
this.e.reply('暂无可用CK请绑定更多用户或设置公共ck..')
this.e.reply(['暂无可用CK请绑定更多用户或设置公共ck..', segment.button([
{ text: "Cookie帮助", callback: "#Cookie帮助" },
])])
}
this.e.noTips = true
@ -342,7 +355,7 @@ export default class MysInfo {
async checkCode (res, type, mysApi = {}, data = {}, isTask = false) {
if (!res) {
if (!isTask) this.e.reply('米游社接口请求失败,暂时无法查询')
if (!isTask) this.e.reply(['米游社接口请求失败,暂时无法查询', this.mysButton])
return false
}
@ -364,30 +377,30 @@ export default class MysInfo {
if (/(登录|login)/i.test(res.message)) {
if (this.ckInfo.uid) {
logger.mark(`[ck失效][uid:${this.uid}][qq:${this.userId}]`)
if (!isTask) this.e.reply(`UID:${this.ckInfo.uid},米游社cookie已失效`)
if (!isTask) this.e.reply([`UID:${this.ckInfo.uid},米游社Cookie已失效`, this.mysButton])
} else {
logger.mark(`[公共ck失效][ltuid:${this.ckInfo.ltuid}]`)
if (!isTask) this.e.reply('米游社查询失败,请稍后再试')
if (!isTask) this.e.reply(['米游社查询失败,请稍后再试', this.mysButton])
}
if (!isTask) await this.delCk()
} else {
if (!isTask) this.e.reply(`米游社接口报错,暂时无法查询:${res.message}`)
if (!isTask) this.e.reply([`米游社接口报错,暂时无法查询:${res.message}`, this.mysButton])
}
break
case 1008:
if (!isTask) this.e.reply('\n请先去米游社绑定角色', false, { at: this.userId })
if (!isTask) this.e.reply(['请先去米游社绑定角色', this.mysButton], false, { at: this.userId })
break
case 10101:
if (!isTask) {
await this.disableToday()
this.e.reply('查询已达今日上限')
this.e.reply(['查询已达今日上限', this.mysButton])
}
break
case 10102:
if (res.message === 'Data is not public for the user') {
if (!isTask) this.e.reply(`\nUID:${this.uid},米游社数据未公开`, false, { at: this.userId })
if (!isTask) this.e.reply([`\nUID:${this.uid},米游社数据未公开`, this.mysButton], false, { at: this.userId })
} else {
if (!isTask) this.e.reply(`uid:${this.uid},请先去米游社绑定角色`)
if (!isTask) this.e.reply([`uid:${this.uid},请先去米游社绑定角色`, this.mysButton])
}
break
// 伙伴不存在~
@ -395,7 +408,7 @@ export default class MysInfo {
if (res.api === 'detail') res.retcode = 0
break
case 5003:
if (!isTask) this.e.reply('米游社账号异常,暂时无法查询')
if (!isTask) this.e.reply(['米游社账号异常,暂时无法查询', this.mysButton])
break
case 1034:
let handler = this.e.runtime?.handler || {}
@ -408,14 +421,14 @@ export default class MysInfo {
if (!res || res?.retcode == 1034) {
logger.mark(`[米游社查询失败][uid:${this.uid}][qq:${this.userId}] 遇到验证码`)
if (!isTask) this.e.reply('米游社查询遇到验证码,请稍后再试')
if (!isTask) this.e.reply(['米游社查询遇到验证码,请稍后再试', this.mysButton])
}
break
case 10307:
if (!isTask) this.e.reply('版本更新期间,数据维护中')
if (!isTask) this.e.reply(['版本更新期间,数据维护中', this.mysButton])
break
default:
if (!isTask) this.e.reply(`米游社接口报错,暂时无法查询:${res.message || 'error'}`)
if (!isTask) this.e.reply([`米游社接口报错,暂时无法查询:${res.message || 'error'}`, this.mysButton])
break
}
if (res.retcode !== 0) {
@ -441,4 +454,4 @@ export default class MysInfo {
/** 统计次数设为超限 */
await this.ckUser.disable(game)
}
}
}

View File

@ -276,11 +276,9 @@ export default class MysNews extends base {
replyMsg(img, title) {
if (!img || img.length <= 0) return false
if (img.length == 1) {
if (title) return [title, ...img]
return img
}
return common.makeForwardMsg(this.e, img, title)
if (title) img = [title, ...img]
if (img.length <= 2) return img
return common.makeForwardMsg(this.e, [img])
}
async mysNewsTask() {

View File

@ -46,7 +46,7 @@ export default class User extends base {
this.e.ck = this.ck
}
if (!this.e.ck) {
await this.e.reply(`请【私聊】发送米游社cookie获取教程\n${set.cookieDoc}`)
await this.e.reply(`请【私聊】发送米游社Cookie获取教程\n${set.cookieDoc}`)
return
}
@ -59,14 +59,14 @@ export default class User extends base {
})
if (!param.cookie_token && !param.cookie_token_v2) {
await this.e.reply('发送cookie不完整\n请退出米游社【重新登录】刷新完整cookie')
await this.e.reply('发送Cookie不完整\n请退出米游社【重新登录】刷新完整Cookie')
return
}
// TODO独立的mys数据不走缓存ltuid
let mys = await MysUser.create(param.ltuid || param.ltuid_v2 || param.account_id_v2 || param.ltmid_v2)
if (!mys) {
await this.e.reply('发送cookie不完整或数据错误')
await this.e.reply('发送Cookie不完整或数据错误')
return
}
let data = {}
@ -92,10 +92,10 @@ export default class User extends base {
/** 检查ck是否失效 */
let uidRet = await mys.reqMysUid()
if (uidRet.status !== 0) {
logger.mark(`绑定cookie错误1${this.checkMsg || 'cookie错误'}`)
logger.mark(`绑定Cookie错误1${this.checkMsg || 'Cookie错误'}`)
// 清除mys数据
mys._delCache()
return await this.e.reply(`绑定cookie失败${this.checkMsg || 'cookie错误'}`)
return await this.e.reply(`绑定Cookie失败${this.checkMsg || 'Cookie错误'}`)
}
// 判断data.ltuid是否是数字
@ -107,22 +107,23 @@ export default class User extends base {
this.ltuid = userInfo.uid || this.ltuid
this.ck = `${this.ck}ltuid=${this.ltuid};`
} else {
logger.mark(`绑定cookie错误2${userFullInfo.message || 'cookie错误'}`)
return await this.e.reply(`绑定cookie失败${userFullInfo.message || 'cookie错误'}`)
logger.mark(`绑定Cookie错误2${userFullInfo.message || 'Cookie错误'}`)
return await this.e.reply(`绑定Cookie失败${userFullInfo.message || 'Cookie错误'}`)
}
}
logger.mark(`${this.e.logFnc} 检查cookie正常 [ltuid:${mys.ltuid}]`)
logger.mark(`${this.e.logFnc} 检查Cookie正常 [ltuid:${mys.ltuid}]`)
await user.addMysUser(mys)
await mys.initCache()
await user.save()
logger.mark(`${this.e.logFnc} 保存cookie成功 [ltuid:${mys.ltuid}]`)
logger.mark(`${this.e.logFnc} 保存Cookie成功 [ltuid:${mys.ltuid}]`)
let uidMsg = ['绑定cookie成功', mys.getUidInfo()]
let uidMsg = ['绑定Cookie成功', mys.getUidInfo()]
await this.e.reply(uidMsg.join('\n'))
let msg = []
let button = []
if (mys.hasGame('gs')) {
msg.push(
'原神模块支持:',
@ -135,6 +136,19 @@ export default class User extends base {
'【#练度统计】技能统计列表',
'【#面板】【#更新面板】面板信息'
)
button.push([
{ text: "#uid", callback: "#uid" },
{ text: "#我的ck", callback: "#我的ck" },
{ text: "#删除ck", callback: "#删除ck" },
],[
{ text: "#体力", callback: "#体力" },
{ text: "#原石", callback: "#原石" },
{ text: "#原石统计", callback: "#原石统计" },
],[
{ text: "#练度统计", callback: "#练度统计" },
{ text: "#面板", callback: "#面板" },
{ text: "#更新面板", callback: "#更新面板" },
])
}
if (mys.hasGame('sr')) {
msg.push(
@ -144,8 +158,16 @@ export default class User extends base {
'【*体力】体力信息',
'【*面板】【*更新面板】面板信息'
)
button.push([
{ text: "*uid", callback: "*uid" },
{ text: "*删除ck", callback: "*删除ck" },
{ text: "*体力", callback: "*体力" },
],[
{ text: "*面板", callback: "*面板" },
{ text: "*更新面板", callback: "*更新面板" },
])
}
msg = await common.makeForwardMsg(this.e, ['使用命令说明', msg.join('\n')], '绑定成功:使用命令说明')
msg = await common.makeForwardMsg(this.e, [[msg.join('\n'), segment.button(...button)]], '绑定成功:使用命令说明')
await this.e.reply(msg)
}
@ -168,7 +190,7 @@ export default class User extends base {
if (!mys) {
return `删除失败当前的UID${uidData?.uid}无CK信息`
}
let msg = ['绑定cookie已删除', mys.getUidInfo()]
let msg = ['绑定Cookie已删除', mys.getUidInfo()]
await user.delMysUser(uidData.ltuid)
return msg.join('\n')
}
@ -188,12 +210,16 @@ export default class User extends base {
let game = this.e
let uidList = user.getUidList(game)
if (index > uidList.length) {
return await this.e.reply('uid序号输入错误')
return await this.e.reply(['uid序号输入错误', segment.button([
{ text: "删除uid", input: "#删除uid" },
])])
}
index = Number(index) - 1
let uidObj = uidList[index]
if (uidObj.type === 'ck') {
return await this.e.reply('CK对应UID无法直接删除请通过【#删除ck】命令来删除')
return await this.e.reply(['CK对应UID无法直接删除请通过【#删除ck】命令来删除', segment.button([
{ text: "删除ck", callback: "#删除ck" },
])])
}
await user.delRegUid(uidObj.uid, game)
return await this.showUid()
@ -248,10 +274,26 @@ export default class User extends base {
}
})
})
let e = this.e
return e.runtime.render('genshin', 'html/user/uid-list', {
uids
})
return this.e.reply([await this.e.runtime.render('genshin', 'html/user/uid-list', { uids }, { retType: "base64" }), segment.button([
{ text: "绑定UID", input: "#绑定uid" },
{ text: "切换UID", input: "#uid" },
{ text: "删除UID", input: "#删除uid" },
],[
{ text: "角色", callback: "#角色" },
{ text: "探索", callback: "#探索" },
{ text: "武器", callback: "#武器" },
{ text: "深渊", callback: "#深渊" },
],[
{ text: "统计", callback: "#练度统计" },
{ text: "面板", callback: "#面板" },
{ text: "体力", callback: "#体力" },
{ text: "原石", callback: "#原石" },
],[
{ text: "留影", callback: "#留影叙佳期" },
{ text: "七圣", callback: "#七圣召唤查询牌组" },
{ text: "抽卡", callback: "#抽卡记录" },
{ text: "充值", callback: "#充值记录" },
])])
}
/** 切换uid */
@ -260,7 +302,9 @@ export default class User extends base {
let game = this.e
let uidList = user.getUidList(game)
if (index > uidList.length) {
return await this.e.reply('uid序号输入错误')
return await this.e.reply(['uid序号输入错误', segment.button([
{ text: "切换uid", input: "#uid" },
])])
}
index = Number(index) - 1
user.setMainUid(index, game)
@ -455,11 +499,13 @@ export default class User extends base {
async myCk () {
let user = await this.user()
if (!user.hasCk) {
this.e.reply('当前尚未绑定cookie')
this.e.reply(['当前尚未绑定Cookie', segment.button([
{ text: "帮助", input: "#Cookie帮助" },
])])
}
let mys = user.getMysUser(this.e)
if (mys) {
await this.e.reply(`当前绑定cookie\nuid${mys.getUid(this.e)}`)
await this.e.reply(`当前绑定Cookie\nuid${mys.getUid(this.e)}`)
await this.e.reply(mys.ck)
}
}
@ -493,7 +539,11 @@ export default class User extends base {
cks.push(`当前生效uid${uid}\n通过【#uid】命令可查看并切换UID`)
}
await this.e.reply(cks.join('\n----\n'), false, { at: true })
await this.e.reply([cks.join('\n----\n'), segment.button([
{ text: "绑定UID", input: "#绑定uid" },
{ text: "切换UID", input: "#uid" },
{ text: "删除UID", input: "#删除uid" },
])], false, { at: true })
}
async userAdmin () {