revert change
This commit is contained in:
parent
fa1d710372
commit
b561ab4b3b
|
@ -1,8 +1,11 @@
|
||||||
# 3.1.0 Dev
|
# 3.1.0
|
||||||
|
|
||||||
* !!!暂未完成,会有很多错误,不建议升级!!!
|
|
||||||
* 重构CK与UID管理逻辑
|
* 重构CK与UID管理逻辑
|
||||||
* 底层对星铁查询进行支持
|
* 支持多UID绑定,可绑定多个UID并进行切换
|
||||||
|
* 支持原神与星铁UID共存,可针对查询命令分配对应UID
|
||||||
|
* 新增`#删除uid1`命令,可对`#uid`列表内的绑定UID进行删除
|
||||||
|
* 使用sqlite进行ck与uid存储
|
||||||
|
* 底层对星铁查询进行支持 **@cvs**
|
||||||
|
|
||||||
# 3.0.2
|
# 3.0.2
|
||||||
|
|
||||||
|
|
30
README.md
30
README.md
|
@ -4,23 +4,27 @@
|
||||||
|
|
||||||
需要同时安装[miao-plugin](https://github.com/yoimiya-kokomi/miao-plugin.git) ,且后续的一些底层改造可能会改变数据结构,无法直接迁回原版Yunzai,请根据自己需求情况慎重安装
|
需要同时安装[miao-plugin](https://github.com/yoimiya-kokomi/miao-plugin.git) ,且后续的一些底层改造可能会改变数据结构,无法直接迁回原版Yunzai,请根据自己需求情况慎重安装
|
||||||
|
|
||||||
|
使用[icqq](https://github.com/icqqjs/icqq) 登录,防止oicq可能出现的低版本问题
|
||||||
|
|
||||||
---
|
---
|
||||||
|
与原版Yunzai-Bot的差异:
|
||||||
|
|
||||||
与原Yunzai独立的仓库,去除了较为敏感的签到功能,以尝试恢复[Github](https://github.com/yoimiya-kokomi/Miao-Yunzai.git)
|
**【注意】:** 由于是独立新的仓库,【只建议新部署/部署后迁移】,不建议原Bot直接换源强更
|
||||||
|
|
||||||
|
* **一些新特性:** Miao-Yunzai会逐步重构,增加新特性与功能,可能会有功能与形态上的变化。如期望功能更加稳定可使用此仓库[Yunzai-V3](https://gitee.com/yoimiya-kokomi/Yunzai-Bot)
|
||||||
|
* **移除了签到功能:** 与原Yunzai独立的仓库,去除了较为敏感的签到功能,以尝试恢复[Github](https://github.com/yoimiya-kokomi/Miao-Yunzai.git)
|
||||||
环境。附加[Gitee](https://gitee.com/yoimiya-kokomi/Miao-Yunzai.git)
|
环境。附加[Gitee](https://gitee.com/yoimiya-kokomi/Miao-Yunzai.git)
|
||||||
|
* **默认启用喵版的功能:** 【#角色】【#深渊】【#帮助】等功能默认启用喵版,原版的逻辑会屏蔽,以便于后续逐步精简资源
|
||||||
* 由于是独立新的仓库,【只建议新部署/部署后迁移】,不建议原Bot直接换源强更
|
|
||||||
* 使用icqq登录,防止oicq可能出现的低版本问题(如只需要此特性,可使用[Yunzai-V3](https://gitee.com/yoimiya-kokomi/Yunzai-Bot) )
|
|
||||||
* 基础功能会保持与Yunzai同步迭代更新,如只需原版Yunzai功能则无需切换
|
|
||||||
|
|
||||||
## Miao-Yunzai后续计划
|
## Miao-Yunzai后续计划
|
||||||
|
|
||||||
先刨坑,但也许会咕咕咕
|
先刨坑,但也许会咕咕咕
|
||||||
|
|
||||||
* 功能与`miao-plugin`部分功能进行整合或升级
|
* 功能与`miao-plugin`部分功能进行整合或升级
|
||||||
* 角色卡片、抽卡分析等使用`miao-plugin`版本
|
* [√] 角色卡片、抽卡分析等使用`miao-plugin`版本
|
||||||
* `miao-plugin`的帮助、设置、版本信息会升至`Miao-Yunzai`,以支持更多场景
|
* `miao-plugin`的帮助、设置、版本信息会升至`Miao-Yunzai`,以支持更多场景
|
||||||
* 一些底层会与`miao-plugin`做更深层的联动,以支持一些高级功能
|
* 一些底层会与`miao-plugin`做更深层的联动,以支持一些高级功能
|
||||||
|
* [√] 星铁底层支持,原神&星铁多UID支持
|
||||||
* 基于面板信息的uid管理及认证
|
* 基于面板信息的uid管理及认证
|
||||||
* ck切换感知等
|
* ck切换感知等
|
||||||
* 逐步实验一些新的特性
|
* 逐步实验一些新的特性
|
||||||
|
@ -77,7 +81,6 @@ pnpm install -P
|
||||||
node app
|
node app
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
## 常见问题
|
## 常见问题
|
||||||
|
|
||||||
### puppeteer 相关问题
|
### puppeteer 相关问题
|
||||||
|
@ -88,26 +91,33 @@ linux环境,其他环境请自行探索
|
||||||
puppeteer Chromium 启动中...
|
puppeteer Chromium 启动中...
|
||||||
Error: Failed to launch the browser process!
|
Error: Failed to launch the browser process!
|
||||||
```
|
```
|
||||||
|
|
||||||
1. 先检查node版本是否大于14 (不大于14请去升级版本)
|
1. 先检查node版本是否大于14 (不大于14请去升级版本)
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
node -v
|
node -v
|
||||||
```
|
```
|
||||||
|
|
||||||
2. 如果大于14 则可能是缺失一些库 请安装这些 (点击代码块右上角直接复制,如果报错可以尝试 sudo)
|
2. 如果大于14 则可能是缺失一些库 请安装这些 (点击代码块右上角直接复制,如果报错可以尝试 sudo)
|
||||||
|
|
||||||
### 依赖库
|
### 依赖库
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
yum install pango.x86_64 libXcomposite.x86_64 libXcursor.x86_64 libXdamage.x86_64 libXext.x86_64 libXi.x86_64 libXtst.x86_64 cups-libs.x86_64 libXScrnSaver.x86_64 libXrandr.x86_64 GConf2.x86_64 alsa-lib.x86_64 atk.x86_64 gtk3.x86_64 -y
|
yum install pango.x86_64 libXcomposite.x86_64 libXcursor.x86_64 libXdamage.x86_64 libXext.x86_64 libXi.x86_64 libXtst.x86_64 cups-libs.x86_64 libXScrnSaver.x86_64 libXrandr.x86_64 GConf2.x86_64 alsa-lib.x86_64 atk.x86_64 gtk3.x86_64 -y
|
||||||
```
|
```
|
||||||
### 字体(实测下来貌似还不够)
|
|
||||||
|
### 乱码字体解决办法(centos,安装不了请换源)
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
yum install ipa-gothic-fonts xorg-x11-fonts-100dpi xorg-x11-fonts-75dpi xorg-x11-utils xorg-x11-fonts-cyrillic xorg-x11-fonts-Type1 xorg-x11-fonts-misc -y
|
yum groupinstall fonts -y
|
||||||
```
|
```
|
||||||
|
|
||||||
## 致谢
|
## 致谢
|
||||||
|
|
||||||
| Nickname | Contribution |
|
| Nickname | Contribution |
|
||||||
|:-------------------------------------------------------------:|-------------------|
|
|:-------------------------------------------------------------:|------------------|
|
||||||
| [Yunzai v3.0](https://gitee.com/le-niao/Yunzai-Bot) | 乐神的Yunzai-Bot V3 |
|
| [Yunzai v3.0](https://gitee.com/le-niao/Yunzai-Bot) | 乐神的Yunzai-Bot V3 |
|
||||||
| [GardenHamster](https://github.com/GardenHamster/GenshinPray) | 模拟抽卡背景素材来源 |
|
| [GardenHamster](https://github.com/GardenHamster/GenshinPray) | 模拟抽卡背景素材来源 |
|
||||||
| [西风驿站](https://bbs.mihoyo.com/ys/collection/839181) | 角色攻略图来源 |
|
| [西风驿站](https://bbs.mihoyo.com/ys/collection/839181) | 角色攻略图来源 |
|
||||||
| [米游社友人A](https://bbs.mihoyo.com/ys/collection/428421) | 角色突破素材图来源 |
|
| [米游社友人A](https://bbs.mihoyo.com/ys/collection/428421) | 角色突破素材图来源 |
|
||||||
|
| [icqq](https://github.com/icqqjs/icqq) | ICQQ |
|
||||||
|
|
|
@ -2,5 +2,5 @@
|
||||||
qq:
|
qq:
|
||||||
# 密码,为空则用扫码登录,扫码登录现在仅能在同一ip下进行
|
# 密码,为空则用扫码登录,扫码登录现在仅能在同一ip下进行
|
||||||
pwd:
|
pwd:
|
||||||
# 1:安卓手机、 2:aPad 、 3:安卓手表、 4:MacOS 、 5:iPad 、 6:old_Android
|
# 1:安卓手机、 2:aPad 、 3:安卓手表、 4:MacOS 、 5:iPad 、 6:安卓8.8.88
|
||||||
platform: 5
|
platform: 6
|
|
@ -62,6 +62,10 @@ class Cfg {
|
||||||
return this.getConfig('renderer');
|
return this.getConfig('renderer');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
get notice() {
|
||||||
|
return this.getConfig('notice');
|
||||||
|
}
|
||||||
|
|
||||||
/** 主人qq */
|
/** 主人qq */
|
||||||
get masterQQ () {
|
get masterQQ () {
|
||||||
let masterQQ = this.getConfig('other').masterQQ || []
|
let masterQQ = this.getConfig('other').masterQQ || []
|
||||||
|
@ -99,6 +103,13 @@ class Cfg {
|
||||||
return { ...def, ...config }
|
return { ...def, ...config }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** notice配置 */
|
||||||
|
getNotice () {
|
||||||
|
let def = this.getdefSet('notice')
|
||||||
|
let config = this.getConfig('notice')
|
||||||
|
return { ...def, ...config }
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param app 功能
|
* @param app 功能
|
||||||
* @param name 配置文件名称
|
* @param name 配置文件名称
|
||||||
|
|
|
@ -31,7 +31,7 @@ async function UpdateTitle() {
|
||||||
title += ' iPad'
|
title += ' iPad'
|
||||||
break
|
break
|
||||||
case 6:
|
case 6:
|
||||||
title += ' old_Android'
|
title += ' 安卓8.8.88'
|
||||||
break
|
break
|
||||||
default:
|
default:
|
||||||
}
|
}
|
||||||
|
@ -73,9 +73,6 @@ async function checkInit () {
|
||||||
/** 检查qq.yaml */
|
/** 检查qq.yaml */
|
||||||
await createQQ()
|
await createQQ()
|
||||||
|
|
||||||
//** 更新标题 */
|
|
||||||
await UpdateTitle()
|
|
||||||
|
|
||||||
/** 日志设置 */
|
/** 日志设置 */
|
||||||
setLog()
|
setLog()
|
||||||
|
|
||||||
|
@ -83,5 +80,8 @@ async function checkInit () {
|
||||||
|
|
||||||
await redisInit()
|
await redisInit()
|
||||||
|
|
||||||
checkRun()
|
await checkRun()
|
||||||
|
|
||||||
|
//** 更新标题 */
|
||||||
|
await UpdateTitle()
|
||||||
}
|
}
|
||||||
|
|
|
@ -33,10 +33,10 @@ export default async function createQQ () {
|
||||||
message: '请选择登录端口:',
|
message: '请选择登录端口:',
|
||||||
name: 'platform',
|
name: 'platform',
|
||||||
default: '6',
|
default: '6',
|
||||||
choices: ['old_Android', 'iPad', '安卓手机', '安卓手表', 'MacOS', 'aPad'],
|
choices: ['安卓8.8.88', 'iPad', '安卓手机', '安卓手表', 'MacOS', 'aPad'],
|
||||||
filter: (val) => {
|
filter: (val) => {
|
||||||
switch (val) {
|
switch (val) {
|
||||||
case 'old_Android':return 6
|
case '安卓8.8.88':return 6
|
||||||
case 'iPad':return 5
|
case 'iPad':return 5
|
||||||
case 'MacOS':return 4
|
case 'MacOS':return 4
|
||||||
case '安卓手机':return 1
|
case '安卓手机':return 1
|
||||||
|
|
|
@ -73,13 +73,18 @@ export default class loginEvent extends EventListener {
|
||||||
type: 'list',
|
type: 'list',
|
||||||
name: 'type',
|
name: 'type',
|
||||||
message: '触发滑动验证,需要获取ticket通过验证,请选择获取方式:',
|
message: '触发滑动验证,需要获取ticket通过验证,请选择获取方式:',
|
||||||
choices: ['1.手动获取ticket', '2.滑动验证app请求码获取']
|
choices: ['0.自动获取ticket', '1.手动获取ticket', '2.滑动验证app请求码获取']
|
||||||
}
|
}
|
||||||
])
|
])
|
||||||
|
|
||||||
await common.sleep(200)
|
await common.sleep(200)
|
||||||
let ticket
|
let ticket
|
||||||
|
|
||||||
|
if (ret.type == '0.自动获取ticket') {
|
||||||
|
ticket = await this.getTicket(event.url)
|
||||||
|
if (!ticket) console.log('\n请求错误,返回手动获取ticket方式\n')
|
||||||
|
}
|
||||||
|
|
||||||
if (ret.type == '2.滑动验证app请求码获取') {
|
if (ret.type == '2.滑动验证app请求码获取') {
|
||||||
ticket = await this.requestCode(event.url)
|
ticket = await this.requestCode(event.url)
|
||||||
if (!ticket) console.log('\n请求错误,返回手动获取ticket方式\n')
|
if (!ticket) console.log('\n请求错误,返回手动获取ticket方式\n')
|
||||||
|
@ -103,6 +108,27 @@ export default class loginEvent extends EventListener {
|
||||||
this.client.submitSlider(ticket.trim())
|
this.client.submitSlider(ticket.trim())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async getTicket (url) {
|
||||||
|
let req = `https://hlhs-nb.cn/captcha/slider?key=${Bot.uin}`
|
||||||
|
await fetch(req, {
|
||||||
|
method: 'POST',
|
||||||
|
body: JSON.stringify({ url })
|
||||||
|
})
|
||||||
|
|
||||||
|
console.log('\n----请打开下方链接并在2分钟内进行验证----')
|
||||||
|
console.log(`${logger.green(req)}\n----完成后将自动进行登录----`)
|
||||||
|
|
||||||
|
for (let i = 0; i < 40; i++) {
|
||||||
|
let res = await fetch(req, {
|
||||||
|
method: 'POST',
|
||||||
|
body: JSON.stringify({ submit: Bot.uin })
|
||||||
|
})
|
||||||
|
res = await res.json()
|
||||||
|
if (res.data?.ticket) return res.data.ticket
|
||||||
|
await common.sleep(3000)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
async requestCode (url) {
|
async requestCode (url) {
|
||||||
let txhelper = {
|
let txhelper = {
|
||||||
url: url.replace('ssl.captcha.qq.com', 'txhelper.glitch.me')
|
url: url.replace('ssl.captcha.qq.com', 'txhelper.glitch.me')
|
||||||
|
|
|
@ -359,7 +359,8 @@ class PluginsLoader {
|
||||||
// 判断是否是星铁命令,若是星铁命令则标准化处理
|
// 判断是否是星铁命令,若是星铁命令则标准化处理
|
||||||
// e.isSr = true,且命令标准化为 #星铁 开头
|
// e.isSr = true,且命令标准化为 #星铁 开头
|
||||||
let srReg = /^#?(\*|星铁|星轨|穹轨|星穹|崩铁|星穹铁道|崩坏星穹铁道|铁道)+/
|
let srReg = /^#?(\*|星铁|星轨|穹轨|星穹|崩铁|星穹铁道|崩坏星穹铁道|铁道)+/
|
||||||
if (srReg.test(msg)) {
|
let gclink = /\/common\//.test(msg)
|
||||||
|
if (srReg.test(msg) || gclink) {
|
||||||
e.isSr = true
|
e.isSr = true
|
||||||
msg = msg.replace(srReg, '#星铁')
|
msg = msg.replace(srReg, '#星铁')
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "miao-yunzai",
|
"name": "miao-yunzai",
|
||||||
"version": "3.0.2",
|
"version": "3.1.0",
|
||||||
"author": "Yoimiya-Kokomi, Le-niao",
|
"author": "Yoimiya-Kokomi, Le-niao",
|
||||||
"description": "QQ group Bot",
|
"description": "QQ group Bot",
|
||||||
"main": "app.js",
|
"main": "app.js",
|
||||||
|
@ -21,7 +21,7 @@
|
||||||
"chalk": "^5.2.0",
|
"chalk": "^5.2.0",
|
||||||
"chokidar": "^3.5.3",
|
"chokidar": "^3.5.3",
|
||||||
"https-proxy-agent": "5.0.1",
|
"https-proxy-agent": "5.0.1",
|
||||||
"icqq": "0.3.1",
|
"icqq": "^0.3.14",
|
||||||
"image-size": "^1.0.2",
|
"image-size": "^1.0.2",
|
||||||
"inquirer": "^8.2.5",
|
"inquirer": "^8.2.5",
|
||||||
"lodash": "^4.17.21",
|
"lodash": "^4.17.21",
|
||||||
|
@ -33,14 +33,14 @@
|
||||||
"node-xlsx": "^0.21.2",
|
"node-xlsx": "^0.21.2",
|
||||||
"oicq": "^2.3.1",
|
"oicq": "^2.3.1",
|
||||||
"pm2": "^5.3.0",
|
"pm2": "^5.3.0",
|
||||||
"puppeteer": "^19.11.1",
|
"puppeteer": "^20.2.1",
|
||||||
"redis": "^4.6.6",
|
"redis": "^4.6.6",
|
||||||
"sequelize": "^6.31.1",
|
"sequelize": "^6.31.1",
|
||||||
"sqlite3": "^5.1.6",
|
"sqlite3": "^5.1.6",
|
||||||
"yaml": "^2.2.2"
|
"yaml": "^2.2.2"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"eslint": "^8.40.0",
|
"eslint": "^8.41.0",
|
||||||
"eslint-config-standard": "^17.0.0",
|
"eslint-config-standard": "^17.0.0",
|
||||||
"eslint-plugin-import": "^2.27.5",
|
"eslint-plugin-import": "^2.27.5",
|
||||||
"eslint-plugin-n": "^15.7.0",
|
"eslint-plugin-n": "^15.7.0",
|
||||||
|
|
|
@ -25,6 +25,7 @@ export class exchange extends plugin {
|
||||||
}
|
}
|
||||||
|
|
||||||
async getCode() {
|
async getCode() {
|
||||||
|
this.code_ver = ''
|
||||||
this.now = parseInt(Date.now() / 1000)
|
this.now = parseInt(Date.now() / 1000)
|
||||||
let actid = await this.getActId()
|
let actid = await this.getActId()
|
||||||
if (!actid) return
|
if (!actid) return
|
||||||
|
@ -36,28 +37,34 @@ export class exchange extends plugin {
|
||||||
if (index.data === null) {
|
if (index.data === null) {
|
||||||
return await this.reply(`错误:\n${index.message}`)
|
return await this.reply(`错误:\n${index.message}`)
|
||||||
}
|
}
|
||||||
this.mi18n = index.data.mi18n
|
|
||||||
let mi18n = await this.getData('mi18n')
|
|
||||||
|
|
||||||
if (index.data.remain > 0) {
|
let index_data = index.data.live;
|
||||||
let version = mi18n['act-title'].match(/\d.\d/g)
|
let title = index_data['title'];
|
||||||
return await this.reply(`暂无直播兑换码\n${version}版本前瞻${mi18n['empty-code-text']}`)
|
this.code_ver = index_data['code_ver'];
|
||||||
|
if (index_data.remain > 0) {
|
||||||
|
return await this.reply(`暂无直播兑换码\n${title}`)
|
||||||
}
|
}
|
||||||
|
|
||||||
let code = await this.getData('code')
|
let code = await this.getData('code')
|
||||||
if (!code) return
|
if (!code || !code.data?.code_list) return
|
||||||
|
let codes = [];
|
||||||
|
|
||||||
|
for (let val of code.data.code_list) {
|
||||||
|
if (val.code){
|
||||||
|
//let title = (val.title || '').replace(/\<.*?\>/g,'')
|
||||||
|
codes.push(val.code)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
code = lodash.map(code, 'code')
|
|
||||||
let msg = ''
|
let msg = ''
|
||||||
if (code.length >= 3) {
|
if (codes.length >= 3) {
|
||||||
msg = [`${mi18n['act-title']}-直播兑换码`, `${mi18n['exchange-tips']}`, ...code]
|
msg = [`${title}-直播兑换码`, `兑换码存在有效期,请及时兑换哦~`, ...codes]
|
||||||
msg = await common.makeForwardMsg(this.e, msg, msg[0])
|
msg = await common.makeForwardMsg(this.e, msg, msg[0])
|
||||||
} else if (this.e.msg.includes('#')) {
|
} else if (this.e.msg.includes('#')) {
|
||||||
msg += code.join('\n')
|
msg += codes.join('\n')
|
||||||
} else {
|
} else {
|
||||||
msg = `${mi18n['act-title']}-直播兑换码\n`
|
msg = `${title}-直播兑换码\n`
|
||||||
msg += `${mi18n['exchange-tips']}\n\n`
|
msg += codes.join('\n')
|
||||||
msg += code.join('\n')
|
|
||||||
}
|
}
|
||||||
|
|
||||||
await this.reply(msg)
|
await this.reply(msg)
|
||||||
|
@ -65,15 +72,19 @@ export class exchange extends plugin {
|
||||||
|
|
||||||
async getData(type) {
|
async getData(type) {
|
||||||
let url = {
|
let url = {
|
||||||
index: `https://api-takumi.mihoyo.com/event/bbslive/index?act_id=${this.actId}`,
|
index: `https://api-takumi.mihoyo.com/event/miyolive/index`,
|
||||||
mi18n: `https://webstatic.mihoyo.com/admin/mi18n/bbs_cn/${this.mi18n}/${this.mi18n}-zh-cn.json`,
|
code: `https://api-takumi-static.mihoyo.com/event/miyolive/refreshCode?version=${this.code_ver}&time=${this.now}`,
|
||||||
code: `https://webstatic.mihoyo.com/bbslive/code/${this.actId}.json?version=1&time=${this.now}`,
|
|
||||||
actId: "https://bbs-api.mihoyo.com/painter/api/user_instant/list?offset=0&size=20&uid=75276550",
|
actId: "https://bbs-api.mihoyo.com/painter/api/user_instant/list?offset=0&size=20&uid=75276550",
|
||||||
}
|
}
|
||||||
|
|
||||||
let response
|
let response
|
||||||
try {
|
try {
|
||||||
response = await fetch(url[type], { method: 'get' })
|
response = await fetch(url[type], {
|
||||||
|
method: 'get',
|
||||||
|
headers: {
|
||||||
|
'x-rpc-act_id': this.actId
|
||||||
|
}
|
||||||
|
})
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
logger.error(error.toString())
|
logger.error(error.toString())
|
||||||
return false
|
return false
|
||||||
|
@ -87,18 +98,6 @@ export class exchange extends plugin {
|
||||||
return res
|
return res
|
||||||
}
|
}
|
||||||
|
|
||||||
// async getActId () {
|
|
||||||
// let ret = await this.getData('actId')
|
|
||||||
// if (!ret || ret.retcode !== 0) return false
|
|
||||||
|
|
||||||
// let post = lodash.map(ret.data.posts, 'post')
|
|
||||||
// post = lodash.maxBy(post, 'created_at')
|
|
||||||
// let actId = post.content.replace(/\[链接\]|\[图片\]/g, '').trim()
|
|
||||||
// if (!actId) return false
|
|
||||||
|
|
||||||
// return actId
|
|
||||||
// }
|
|
||||||
|
|
||||||
async getActId() {
|
async getActId() {
|
||||||
// 获取 "act_id"
|
// 获取 "act_id"
|
||||||
let ret = await this.getData('actId')
|
let ret = await this.getData('actId')
|
||||||
|
@ -119,7 +118,7 @@ export class exchange extends plugin {
|
||||||
let shit = JSON.parse(post.structured_content);
|
let shit = JSON.parse(post.structured_content);
|
||||||
for (let segment of shit) {
|
for (let segment of shit) {
|
||||||
if (segment.insert.toString().includes('观看直播') && segment.attributes.link) {
|
if (segment.insert.toString().includes('观看直播') && segment.attributes.link) {
|
||||||
let matched = segment.attributes.link.match(/act_id=(\d{8}ys\d{4})/);
|
let matched = segment.attributes.link.match(/act_id=(.*?)&/);
|
||||||
if (matched) {
|
if (matched) {
|
||||||
actId = matched[1];
|
actId = matched[1];
|
||||||
}
|
}
|
||||||
|
|
|
@ -60,12 +60,20 @@ export class mysNews extends plugin {
|
||||||
this.file = './plugins/genshin/config/mys.pushNews.yaml'
|
this.file = './plugins/genshin/config/mys.pushNews.yaml'
|
||||||
|
|
||||||
/** 定时任务 */
|
/** 定时任务 */
|
||||||
this.task = {
|
this.task = [
|
||||||
|
{
|
||||||
cron: gsCfg.getConfig('mys', 'pushNews').pushTime,
|
cron: gsCfg.getConfig('mys', 'pushNews').pushTime,
|
||||||
name: '米游社公告推送任务',
|
name: '米游社公告推送任务',
|
||||||
fnc: () => this.mysNewsTask(),
|
fnc: () => this.mysNewsTask(),
|
||||||
log: false
|
log: false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
cron: gsCfg.getConfig('mys', 'pushNews').pushTime,
|
||||||
|
name: '崩坏星穹铁道公告推送任务',
|
||||||
|
fnc: () => this.srmysNewsTask(),
|
||||||
|
log: false
|
||||||
}
|
}
|
||||||
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
async init () {
|
async init () {
|
||||||
|
@ -87,7 +95,7 @@ export class mysNews extends plugin {
|
||||||
}
|
}
|
||||||
|
|
||||||
async mysNewsTask () {
|
async mysNewsTask () {
|
||||||
let mysNews = new srNews(this.e)
|
let mysNews = new MysNews(this.e)
|
||||||
await mysNews.mysNewsTask()
|
await mysNews.mysNewsTask()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -37,6 +37,10 @@ export class user extends plugin {
|
||||||
reg: '^#?删除(ck|cookie)$',
|
reg: '^#?删除(ck|cookie)$',
|
||||||
fnc: 'delCk'
|
fnc: 'delCk'
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
reg: '^#?(原神|星铁)?(删除|解绑)uid\\s*[0-9]{1,2}$',
|
||||||
|
fnc: 'delUid'
|
||||||
|
},
|
||||||
{
|
{
|
||||||
reg: '^#(原神|星铁)?绑定(uid|UID)?[1-9][0-9]{8}$',
|
reg: '^#(原神|星铁)?绑定(uid|UID)?[1-9][0-9]{8}$',
|
||||||
fnc: 'bingUid'
|
fnc: 'bingUid'
|
||||||
|
@ -146,6 +150,15 @@ export class user extends plugin {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async delUid () {
|
||||||
|
let index = this.e.msg.match(/[0-9]{1,2}$/g)
|
||||||
|
let uidIdx = index && index[0]
|
||||||
|
let game = this.e
|
||||||
|
if (uidIdx) {
|
||||||
|
await this.User.delUid(uidIdx, game)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/** 我的ck */
|
/** 我的ck */
|
||||||
async myCk () {
|
async myCk () {
|
||||||
if (this.e.isGroup) {
|
if (this.e.isGroup) {
|
||||||
|
|
|
@ -1,3 +1,21 @@
|
||||||
|
- up4:
|
||||||
|
- 绮良良
|
||||||
|
- 云堇
|
||||||
|
- 重云
|
||||||
|
up5:
|
||||||
|
- 宵宫
|
||||||
|
up5_2:
|
||||||
|
- 八重神子
|
||||||
|
weapon5:
|
||||||
|
- 飞雷之弦振
|
||||||
|
- 神乐之真意
|
||||||
|
weapon4:
|
||||||
|
- 恶王丸
|
||||||
|
- 笛剑
|
||||||
|
- 匣里灭辰
|
||||||
|
- 流浪乐章
|
||||||
|
- 弓藏
|
||||||
|
endTime: "2023-06-13 18:00:00"
|
||||||
- up4:
|
- up4:
|
||||||
- 卡维
|
- 卡维
|
||||||
- 坎蒂丝
|
- 坎蒂丝
|
||||||
|
|
|
@ -1,3 +1,12 @@
|
||||||
|
- from: '2023-05-17 18:00:00'
|
||||||
|
to: '2023-06-06 14:59:59'
|
||||||
|
five:
|
||||||
|
- 景元
|
||||||
|
four:
|
||||||
|
- 停云
|
||||||
|
- 素裳
|
||||||
|
- 三月七
|
||||||
|
name: 天戈麾斥
|
||||||
- from: '2023-04-26 08:00:00'
|
- from: '2023-04-26 08:00:00'
|
||||||
to: '2023-05-17 16:00:00'
|
to: '2023-05-17 16:00:00'
|
||||||
five:
|
five:
|
||||||
|
|
|
@ -1,3 +1,12 @@
|
||||||
|
- from: '2023-05-17 18:00:00'
|
||||||
|
to: '2023-06-06 14:59:59'
|
||||||
|
five:
|
||||||
|
- 拂晓之前
|
||||||
|
four:
|
||||||
|
- 与行星相会
|
||||||
|
- 唯有沉默
|
||||||
|
- 余生的第一天
|
||||||
|
name: 流光定影
|
||||||
- from: '2023-04-26 08:00:00'
|
- from: '2023-04-26 08:00:00'
|
||||||
to: '2023-05-17 16:00:00'
|
to: '2023-05-17 16:00:00'
|
||||||
five:
|
five:
|
||||||
|
|
|
@ -1,3 +1,13 @@
|
||||||
|
- from: '2023-05-24 06:00:00'
|
||||||
|
to: '2023-06-13 17:59:59'
|
||||||
|
five:
|
||||||
|
- 宵宫
|
||||||
|
- 八重神子
|
||||||
|
four:
|
||||||
|
- 绮良良
|
||||||
|
- 云堇
|
||||||
|
- 重云
|
||||||
|
name: 焰色天河|华紫樱绯
|
||||||
- from: '2023-05-02 18:00:00'
|
- from: '2023-05-02 18:00:00'
|
||||||
to: '2023-05-23 14:59:59'
|
to: '2023-05-23 14:59:59'
|
||||||
five:
|
five:
|
||||||
|
|
|
@ -1,3 +1,15 @@
|
||||||
|
- from: '2023-05-24 06:00:00'
|
||||||
|
to: '2023-06-13 17:59:59'
|
||||||
|
five:
|
||||||
|
- 飞雷之弦振
|
||||||
|
- 神乐之真意
|
||||||
|
four:
|
||||||
|
- 恶王丸
|
||||||
|
- 笛剑
|
||||||
|
- 匣里灭辰
|
||||||
|
- 流浪乐章
|
||||||
|
- 弓藏
|
||||||
|
name: 神铸赋形
|
||||||
- from: '2023-05-02 18:00:00'
|
- from: '2023-05-02 18:00:00'
|
||||||
to: '2023-05-23 14:59:59'
|
to: '2023-05-23 14:59:59'
|
||||||
five:
|
five:
|
||||||
|
|
|
@ -18,7 +18,6 @@ export default class BaseModel extends Model {
|
||||||
|
|
||||||
static initDB (model, columns) {
|
static initDB (model, columns) {
|
||||||
let name = model.name
|
let name = model.name
|
||||||
console.log('Model Name', name)
|
|
||||||
name = name.replace(/DB$/, 's')
|
name = name.replace(/DB$/, 's')
|
||||||
model.init(columns, { sequelize, tableName: name })
|
model.init(columns, { sequelize, tableName: name })
|
||||||
model.COLUMNS = columns
|
model.COLUMNS = columns
|
||||||
|
|
|
@ -55,7 +55,7 @@ export default class GachaLog extends base {
|
||||||
if (i <= 1) await common.sleep(500)
|
if (i <= 1) await common.sleep(500)
|
||||||
}
|
}
|
||||||
|
|
||||||
await this.e.reply(`抽卡记录更新完成,您还可回复\n【#${this?.e?.isSr?'光锥':'武器'}记录】统计${this?.e?.isSr?'光锥':'武器'}池数据\n【#角色统计】按卡池统计数据\n【#导出记录】导出记录数据`)
|
await this.e.reply(`抽卡记录更新完成,您还可回复\n【#${this?.e?.isSr?'星铁光锥':'武器'}记录】统计${this?.e?.isSr?'星铁光锥':'武器'}池数据\n【#${this?.e?.isSr?'星铁':''}角色统计】按卡池统计数据\n【#导出记录】导出记录数据`)
|
||||||
|
|
||||||
this.isLogUrl = true
|
this.isLogUrl = true
|
||||||
|
|
||||||
|
@ -82,7 +82,8 @@ export default class GachaLog extends base {
|
||||||
|
|
||||||
dealUrl(url) {
|
dealUrl(url) {
|
||||||
// timestamp=1641338980〈=zh-cn 修复链接有奇怪符号
|
// timestamp=1641338980〈=zh-cn 修复链接有奇怪符号
|
||||||
url = url.replace(/〈=/g, '&').split('getGachaLog?')[1]
|
url = url.replace(/〈=/g, '&')
|
||||||
|
if (url.includes("getGachaLog?")) url = url.split('getGachaLog?')[1]
|
||||||
|
|
||||||
// 处理参数
|
// 处理参数
|
||||||
let arr = new URLSearchParams(url).entries()
|
let arr = new URLSearchParams(url).entries()
|
||||||
|
|
|
@ -158,6 +158,7 @@ export default class NoteUser extends BaseModel {
|
||||||
})
|
})
|
||||||
|
|
||||||
let uidReg = /\d{9}/
|
let uidReg = /\d{9}/
|
||||||
|
let regUidCount = 0
|
||||||
|
|
||||||
// 存在数据库记录则进行设置
|
// 存在数据库记录则进行设置
|
||||||
if (gameDB) {
|
if (gameDB) {
|
||||||
|
@ -166,9 +167,10 @@ export default class NoteUser extends BaseModel {
|
||||||
lodash.forEach(['verify', 'reg'], (uidType) => {
|
lodash.forEach(['verify', 'reg'], (uidType) => {
|
||||||
lodash.forEach(regUids, (ds, uid) => {
|
lodash.forEach(regUids, (ds, uid) => {
|
||||||
uid = uid + ''
|
uid = uid + ''
|
||||||
if (uid && uidReg.test(uid) && ds.type === uidType && !uidMap[key][uid]) {
|
if (regUidCount <= 5 && uid && uidReg.test(uid) && ds.type === uidType && !uidMap[key][uid]) {
|
||||||
uidMap[key][uid] = { uid, type: ds.type }
|
uidMap[key][uid] = { uid, type: ds.type }
|
||||||
uidList[key].push(uid)
|
uidList[key].push(uid)
|
||||||
|
regUidCount++
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
@ -242,21 +244,32 @@ export default class NoteUser extends BaseModel {
|
||||||
|
|
||||||
|
|
||||||
// 添加UID
|
// 添加UID
|
||||||
addRegUid (uid, game = 'gs') {
|
async addRegUid (uid, game = 'gs') {
|
||||||
let gameKey = this.gameKey(game)
|
let gameKey = this.gameKey(game)
|
||||||
uid = uid + ''
|
uid = uid + ''
|
||||||
if (!this.uidMap[gameKey][uid]) {
|
if (!this.uidMap[gameKey][uid]) {
|
||||||
this.uidMap[gameKey][uid] = { uid, type: 'reg' }
|
this.uidMap[gameKey][uid] = { uid, type: 'reg' }
|
||||||
}
|
}
|
||||||
|
await this.save()
|
||||||
this.setMainUid(uid, game)
|
this.setMainUid(uid, game)
|
||||||
|
// todo 优化保存
|
||||||
|
await this.save()
|
||||||
}
|
}
|
||||||
|
|
||||||
// 删除UID
|
// 删除UID
|
||||||
delRegUid (uid, game = 'gs') {
|
async delRegUid (uid, game = 'gs') {
|
||||||
let gameKey = this.gameKey(game)
|
let gameKey = this.gameKey(game)
|
||||||
if (this.uidMap[gameKey][uid] && this.uidMap[gameKey][uid].type !== 'ck') {
|
if (this.uidMap[gameKey][uid] && this.uidMap[gameKey][uid].type !== 'ck') {
|
||||||
|
lodash.remove(this.uidList[gameKey], (u) => u + '' === uid + '')
|
||||||
delete this.uidMap[gameKey][uid]
|
delete this.uidMap[gameKey][uid]
|
||||||
lodash.remove(this.uidList[gameKey], (u) => u === uid)
|
if (this.mainUid[gameKey] === uid) {
|
||||||
|
this.mainUid[gameKey] = ''
|
||||||
|
}
|
||||||
|
}
|
||||||
|
await this.save()
|
||||||
|
if (this.mainUid[gameKey] === '') {
|
||||||
|
this.setMainUid(this.uidList[gameKey][0], game)
|
||||||
|
await this.save()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -277,7 +290,7 @@ export default class NoteUser extends BaseModel {
|
||||||
* @param force 若已存在绑定uid关系是否强制更新
|
* @param force 若已存在绑定uid关系是否强制更新
|
||||||
*/
|
*/
|
||||||
async setRegUid (uid = '', game = 'gs', force = false) {
|
async setRegUid (uid = '', game = 'gs', force = false) {
|
||||||
if (this.getRegUid(game) && false) {
|
if (this.getRegUid(game) && !force) {
|
||||||
return uid
|
return uid
|
||||||
}
|
}
|
||||||
await this.addRegUid(uid, game)
|
await this.addRegUid(uid, game)
|
||||||
|
|
|
@ -118,7 +118,7 @@ export default class MysInfo {
|
||||||
if (!matchMsgUid) uid = user.getUid(e)
|
if (!matchMsgUid) uid = user.getUid(e)
|
||||||
if (uid) {
|
if (uid) {
|
||||||
/** 没有绑定的自动绑定 */
|
/** 没有绑定的自动绑定 */
|
||||||
return await user.setRegUid(uid, false)
|
return await user.setRegUid(uid, e, false)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (e.noTips !== true) e.reply('请先#绑定uid', false, { at })
|
if (e.noTips !== true) e.reply('请先#绑定uid', false, { at })
|
||||||
|
|
|
@ -48,7 +48,6 @@ export default class Note extends base {
|
||||||
let { data } = res
|
let { data } = res
|
||||||
let nowDay = moment().date()
|
let nowDay = moment().date()
|
||||||
let nowUnix = Number(moment().format('X'))
|
let nowUnix = Number(moment().format('X'))
|
||||||
|
|
||||||
/** 树脂 */
|
/** 树脂 */
|
||||||
let resinMaxTime
|
let resinMaxTime
|
||||||
if (data.stamina_recover_time > 0) {
|
if (data.stamina_recover_time > 0) {
|
||||||
|
|
|
@ -44,86 +44,13 @@ export default class MysNews extends base {
|
||||||
|
|
||||||
const param = await this.newsDetail(postId)
|
const param = await this.newsDetail(postId)
|
||||||
|
|
||||||
const img = await this.rander(param)
|
const img = await this.render(param)
|
||||||
|
|
||||||
return await this.replyMsg(img, `崩坏星穹铁道${typeName}:${param.data.post.subject}`)
|
return await this.replyMsg(img, `崩坏星穹铁道${typeName}:${param.data.post.subject}`)
|
||||||
}
|
}
|
||||||
|
|
||||||
async rander (param) {
|
async render (param) {
|
||||||
const pageHeight = 7000
|
return await puppeteer.screenshots(this.model, param)
|
||||||
|
|
||||||
await puppeteer.browserInit()
|
|
||||||
|
|
||||||
if (!puppeteer.browser) return false
|
|
||||||
|
|
||||||
const savePath = puppeteer.dealTpl('mysNews', param)
|
|
||||||
if (!savePath) return false
|
|
||||||
|
|
||||||
const page = await puppeteer.browser.newPage()
|
|
||||||
try {
|
|
||||||
await page.goto(`file://${_path}${lodash.trim(savePath, '.')}`, { timeout: 120000 })
|
|
||||||
const body = await page.$('#container') || await page.$('body')
|
|
||||||
const boundingBox = await body.boundingBox()
|
|
||||||
|
|
||||||
const num = Math.round(boundingBox.height / pageHeight) || 1
|
|
||||||
|
|
||||||
if (num > 1) {
|
|
||||||
await page.setViewport({
|
|
||||||
width: boundingBox.width,
|
|
||||||
height: pageHeight + 100
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
const img = []
|
|
||||||
for (let i = 1; i <= num; i++) {
|
|
||||||
const randData = {
|
|
||||||
type: 'jpeg',
|
|
||||||
quality: 90
|
|
||||||
}
|
|
||||||
|
|
||||||
if (i != 1 && i == num) {
|
|
||||||
await page.setViewport({
|
|
||||||
width: boundingBox.width,
|
|
||||||
height: parseInt(boundingBox.height) - pageHeight * (num - 1)
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
if (i != 1 && i <= num) {
|
|
||||||
await page.evaluate(() => window.scrollBy(0, 7000))
|
|
||||||
}
|
|
||||||
|
|
||||||
let buff
|
|
||||||
if (num == 1) {
|
|
||||||
buff = await body.screenshot(randData)
|
|
||||||
} else {
|
|
||||||
buff = await page.screenshot(randData)
|
|
||||||
}
|
|
||||||
|
|
||||||
if (num > 2) await common.sleep(200)
|
|
||||||
|
|
||||||
puppeteer.renderNum++
|
|
||||||
/** 计算图片大小 */
|
|
||||||
const kb = (buff.length / 1024).toFixed(2) + 'kb'
|
|
||||||
|
|
||||||
logger.mark(`[图片生成][${this.model}][${puppeteer.renderNum}次] ${kb}`)
|
|
||||||
|
|
||||||
img.push(segment.image(buff))
|
|
||||||
}
|
|
||||||
|
|
||||||
await page.close().catch((err) => logger.error(err))
|
|
||||||
|
|
||||||
if (num > 1) {
|
|
||||||
logger.mark(`[图片生成][${this.model}] 处理完成`)
|
|
||||||
}
|
|
||||||
return img
|
|
||||||
} catch (error) {
|
|
||||||
logger.error(`图片生成失败:${this.model}:${error}`)
|
|
||||||
/** 关闭浏览器 */
|
|
||||||
if (puppeteer.browser) {
|
|
||||||
await puppeteer.browser.close().catch((err) => logger.error(err))
|
|
||||||
}
|
|
||||||
puppeteer.browser = false
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
async newsDetail (postId) {
|
async newsDetail (postId) {
|
||||||
|
@ -324,7 +251,7 @@ export default class MysNews extends base {
|
||||||
logger.mark(`[崩坏星穹铁道${typeName}推送] ${param.data.post.subject}`)
|
logger.mark(`[崩坏星穹铁道${typeName}推送] ${param.data.post.subject}`)
|
||||||
|
|
||||||
this[postId] = {
|
this[postId] = {
|
||||||
img: await this.rander(param),
|
img: await this.render(param),
|
||||||
title: param.data.post.subject
|
title: param.data.post.subject
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,7 +6,6 @@ import common from '../../../lib/common/common.js'
|
||||||
import MysInfo from './mys/mysInfo.js'
|
import MysInfo from './mys/mysInfo.js'
|
||||||
import NoteUser from './mys/NoteUser.js'
|
import NoteUser from './mys/NoteUser.js'
|
||||||
import MysUser from './mys/MysUser.js'
|
import MysUser from './mys/MysUser.js'
|
||||||
import MysUtil from './mys/MysUtil.js'
|
|
||||||
import { promisify } from 'node:util'
|
import { promisify } from 'node:util'
|
||||||
import YAML from 'yaml'
|
import YAML from 'yaml'
|
||||||
import { Data } from '#miao'
|
import { Data } from '#miao'
|
||||||
|
@ -156,8 +155,23 @@ export default class User extends base {
|
||||||
if (!uid) return
|
if (!uid) return
|
||||||
uid = uid[0]
|
uid = uid[0]
|
||||||
let user = await this.user()
|
let user = await this.user()
|
||||||
user.addRegUid(uid, this.e)
|
await user.addRegUid(uid, this.e)
|
||||||
await user.save()
|
return await this.showUid()
|
||||||
|
}
|
||||||
|
|
||||||
|
async delUid (index) {
|
||||||
|
let user = await this.user()
|
||||||
|
let game = this.e
|
||||||
|
let uidList = user.getUidList(game)
|
||||||
|
if (index > uidList.length) {
|
||||||
|
return await this.e.reply('uid序号输入错误')
|
||||||
|
}
|
||||||
|
index = Number(index) - 1
|
||||||
|
let uidObj = uidList[index]
|
||||||
|
if (uidObj.type === 'ck') {
|
||||||
|
return await this.e.reply('CK对应UID无法直接删除,请通过【#删除ck】命令来删除')
|
||||||
|
}
|
||||||
|
await user.delRegUid(uidObj.uid, game)
|
||||||
return await this.showUid()
|
return await this.showUid()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -165,27 +179,25 @@ export default class User extends base {
|
||||||
async showUid () {
|
async showUid () {
|
||||||
let user = await this.user()
|
let user = await this.user()
|
||||||
let msg = []
|
let msg = []
|
||||||
lodash.forEach({ gs: '原神', sr: '星穹铁道' }, (gameName, game) => {
|
let typeMap = { ck: 'CK Uid', reg: '绑定 Uid' }
|
||||||
|
lodash.forEach({ gs: '原神 (#uid)', sr: '星穹铁道 (*uid)' }, (gameName, game) => {
|
||||||
let uidList = user.getUidList(game)
|
let uidList = user.getUidList(game)
|
||||||
let currUid = user.getUid(game)
|
let currUid = user.getUid(game)
|
||||||
|
msg.push(`【${gameName}】`)
|
||||||
if (uidList.length === 0) {
|
if (uidList.length === 0) {
|
||||||
|
msg.push(`暂无,通过${game === 'gs' ? '#' : '*'}绑定123456789来绑定UID`)
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
msg.push(`【${gameName}】`)
|
|
||||||
lodash.forEach(uidList, (ds, idx) => {
|
lodash.forEach(uidList, (ds, idx) => {
|
||||||
let tmp = `${++idx}: ${ds.uid} (${ds.type})`
|
let tmp = `${++idx}: ${ds.uid} (${typeMap[ds.type]})`
|
||||||
if (currUid * 1 === ds.uid * 1) {
|
if (currUid * 1 === ds.uid * 1) {
|
||||||
tmp += ' ☑'
|
tmp += ' ☑'
|
||||||
}
|
}
|
||||||
msg.push(tmp)
|
msg.push(tmp)
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
if (msg.length > 0) {
|
msg.unshift('通过【#uid+序号】来切换uid,【#删除uid+序号】删除uid')
|
||||||
msg.unshift('通过【#uid+序号】来切换uid')
|
|
||||||
await this.e.reply(msg.join('\n'))
|
await this.e.reply(msg.join('\n'))
|
||||||
} else {
|
|
||||||
await this.e.reply('尚未绑定UID,发送CK或通过【#绑定123456789】命令来绑定UID')
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 切换uid */
|
/** 切换uid */
|
||||||
|
@ -255,10 +267,14 @@ export default class User extends base {
|
||||||
/** 加载V3ck */
|
/** 加载V3ck */
|
||||||
async loadOldDataV3 (data) {
|
async loadOldDataV3 (data) {
|
||||||
let dir = './data/MysCookie/'
|
let dir = './data/MysCookie/'
|
||||||
Data.createDir('./data/MysCookieBak')
|
Data.createDir('./temp/MysCookieBak')
|
||||||
let files = fs.readdirSync(dir).filter(file => file.endsWith('.yaml'))
|
let files = fs.readdirSync(dir).filter(file => file.endsWith('.yaml'))
|
||||||
const readFile = promisify(fs.readFile)
|
const readFile = promisify(fs.readFile)
|
||||||
let promises = []
|
let promises = []
|
||||||
|
if (files.length === 0) {
|
||||||
|
fs.rmdirSync('./data/MysCookie/')
|
||||||
|
return
|
||||||
|
}
|
||||||
files.forEach((v) => promises.push(readFile(`${dir}${v}`, 'utf8')))
|
files.forEach((v) => promises.push(readFile(`${dir}${v}`, 'utf8')))
|
||||||
const res = await Promise.all(promises)
|
const res = await Promise.all(promises)
|
||||||
let ret = {}
|
let ret = {}
|
||||||
|
@ -321,7 +337,7 @@ export default class User extends base {
|
||||||
}
|
}
|
||||||
await user.save()
|
await user.save()
|
||||||
if (fs.existsSync(`./data/MysCookie/${qq}.yaml`)) {
|
if (fs.existsSync(`./data/MysCookie/${qq}.yaml`)) {
|
||||||
fs.rename(`./data/MysCookie/${qq}.yaml`, `./data/MysCookieBak/${qq}.yaml`, (err) => {
|
fs.rename(`./data/MysCookie/${qq}.yaml`, `./temp/MysCookieBak/${qq}.yaml`, (err) => {
|
||||||
if (err) console.log(err)
|
if (err) console.log(err)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
|
@ -104,7 +104,7 @@ export class update extends plugin {
|
||||||
let type = '更新'
|
let type = '更新'
|
||||||
if (this.e.msg.includes('强制')) {
|
if (this.e.msg.includes('强制')) {
|
||||||
type = '强制更新'
|
type = '强制更新'
|
||||||
cm = `git reset --hard origin/master && ${cm}`
|
cm = `git fetch --all && git reset --hard && ${cm}`
|
||||||
}
|
}
|
||||||
|
|
||||||
if (plugin) {
|
if (plugin) {
|
||||||
|
|
Loading…
Reference in New Issue