fix: 兼容旧目录

This commit is contained in:
ningmengchongshui 2024-06-15 12:27:43 +08:00
parent 1fa6984ce5
commit 9ff5288458
14 changed files with 68 additions and 52 deletions

View File

@ -28,8 +28,9 @@ export class setPubCk extends plugin {
]
})
this.file = "./plugins/genshin/config/mys.pubCk.yaml"
}
file = "./plugins/genshin/config/mys.pubCk.yaml"
/** 配置公共ck */
async setPubCk () {

View File

@ -1,5 +1,5 @@
import { plugin } from 'yunzai/core'
import { gsCfg} from 'yunzai/mys'
import { plugin } from 'yunzai/core'
import { gsCfg } from 'yunzai/mys'
import lodash from 'lodash'
import fs from 'node:fs'
import fetch from 'node-fetch'
@ -15,7 +15,28 @@ gsCfg.cpCfg('mys', 'set')
* K 🌌
*/
export class strategy extends plugin {
constructor () {
path = './temp/strategy'
url = 'https://bbs-api.mihoyo.com/post/wapi/getPostFullInCollection?&gids=2&order_type=2&collection_id='
collection_id = [
[],
// 来源:西风驿站
[2319292, 2319293, 2319295, 2319296, 2319299, 2319294, 2319298],
// 来源:原神观测枢
[813033],
// 来源:派蒙喵喵屋
[341284],
// 来源OH是姜姜呀(需特殊处理)
[341523],
// 来源曉K → 废物一个
[1582613],
// 来源:坤易
[22148],
// 来源:婧枫赛赛
[1812949]
]
source = ['西风驿站', '原神观测枢', '派蒙喵喵屋', 'OH是姜姜呀', '曉K', '坤易', '婧枫赛赛']
oss = '?x-oss-process=image//resize,s_1200/quality,q_90/auto-orient,0/interlace,1/format,jpg'
constructor() {
/**
*
name: '米游社攻略',
@ -38,37 +59,11 @@ export class strategy extends plugin {
}
]
})
this.set = gsCfg.getConfig('mys', 'set')
this.path = './temp/strategy'
this.url = 'https://bbs-api.mihoyo.com/post/wapi/getPostFullInCollection?&gids=2&order_type=2&collection_id='
this.collection_id = [
[],
// 来源:西风驿站
[2319292, 2319293, 2319295, 2319296, 2319299, 2319294, 2319298],
// 来源:原神观测枢
[813033],
// 来源:派蒙喵喵屋
[341284],
// 来源OH是姜姜呀(需特殊处理)
[341523],
// 来源曉K → 废物一个
[1582613],
// 来源:坤易
[22148],
// 来源:婧枫赛赛
[1812949]
]
this.source = ['西风驿站', '原神观测枢', '派蒙喵喵屋', 'OH是姜姜呀', '曉K', '坤易', '婧枫赛赛']
this.oss = '?x-oss-process=image//resize,s_1200/quality,q_90/auto-orient,0/interlace,1/format,jpg'
}
/** 初始化创建配置文件 */
async init () {
async init() {
if (!fs.existsSync(this.path)) {
fs.mkdirSync(this.path)
}
@ -82,7 +77,7 @@ export class strategy extends plugin {
}
/** #心海攻略 */
async strategy () {
async strategy() {
let match = /^#?(更新)?(\S+)攻略([1-7])?$/.exec(this.e.msg)
// let isUpdate = !!this.e.msg.includes('更新')
@ -127,19 +122,19 @@ export class strategy extends plugin {
}
/** #攻略帮助 */
async strategy_help () {
async strategy_help() {
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 () {
async strategy_setting() {
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#设置默认攻略[1234567] \n 请增加数字1-7其中一个')
return
if (isNaN(num)) {
await this.e.reply('默认攻略设置方式为: \n#设置默认攻略[1234567] \n 请增加数字1-7其中一个')
return
}
config = config.replace(/defaultSource: [1-7]/g, 'defaultSource: ' + num)
fs.writeFileSync(set, config, 'utf8')
@ -148,7 +143,7 @@ export class strategy extends plugin {
}
/** 下载攻略图 */
async getImg (name, group) {
async getImg(name, group) {
let msyRes = []
this.collection_id[group].forEach((id) => msyRes.push(this.getData(this.url + id)))
@ -208,7 +203,7 @@ export class strategy extends plugin {
}
/** 获取数据 */
async getData (url) {
async getData(url) {
let response = await fetch(url, { method: 'get' })
if (!response.ok) {
return false

View File

@ -2,9 +2,7 @@ import { plugin } from 'yunzai/core'
import { gsCfg} from 'yunzai/mys'
import User from '../model/user.js'
export class user extends plugin {
User = null
constructor(e) {
/**
*

View File

@ -2,6 +2,8 @@ import { plugin } from 'yunzai/core'
import User from '../model/user.js'
import { MysInfo } from 'yunzai/mys'
export class userAdmin extends plugin {
User = null
button = null
constructor(e) {
/**
name: '用户管理',

View File

@ -1,10 +0,0 @@
#!/usr/bin/env sh
# 确保脚本抛出遇到的错误
set -e
git init
git add -A
git commit -m 'update: 修复引用'
git push -f git@github.com:yoimiya-kokomi/Miao-Yunzai.git master:genshin

View File

@ -2,6 +2,7 @@ import moment from 'moment'
import lodash from 'lodash'
import base from './base.js'
import { MysInfo } from 'yunzai/mys'
// tudo
import { Character } from '#miao.models'
export default class Abyss extends base {

View File

@ -1,5 +1,9 @@
import _ from 'lodash'
import { ConfigController as cfg } from 'yunzai/config'
// tudo
import { Common, Version } from '#miao'
import { Character } from '#miao.models'

View File

@ -1,7 +1,12 @@
import base from './base.js'
import { gsCfg } from 'yunzai/mys'
import lodash from 'lodash'
import moment from 'moment'
import moment from 'moment'
// tudo
import { Character, Weapon } from '#miao.models'
export default class GachaData extends base {

View File

@ -4,6 +4,9 @@ import lodash from "lodash"
import fs from "node:fs"
import { downFile, sleep} from 'yunzai/utils'
import { gsCfg } from 'yunzai/mys'
// tudo
import { Character, Weapon } from "#miao.models"
export default class GachaLog extends base {

2
model/gsCfg.ts Normal file
View File

@ -0,0 +1,2 @@
import { GSCfg} from 'yunzai/mys'
export default GSCfg

View File

@ -3,6 +3,10 @@ import lodash from 'lodash'
import base from './base.js'
import { MysInfo, } from 'yunzai/mys'
// tudo
import { Character } from '#miao.models'
export default class Note extends base {

View File

@ -3,6 +3,10 @@ import { gsCfg } from 'yunzai/mys'
import lodash from 'lodash'
import moment from 'moment'
import fs from 'node:fs'
// tudo
import { Character } from '#miao.models'
let dsz = '待实装'

View File

@ -6,6 +6,10 @@ import { gsCfg, MysUser, NoteUser } from 'yunzai/mys'
import { promisify } from 'node:util'
import YAML from 'yaml'
import { UserGameDB, sequelize } from 'yunzai/db'
// tudo
import { Data } from '#miao'
import { Player } from '#miao.models'

View File

@ -2,6 +2,9 @@ import base from './base.js'
import { MysInfo } from 'yunzai/mys'
import {gsCfg} from 'yunzai/mys'
import lodash from 'lodash'
// tudo
import { Weapon, Character } from '#miao.models'
export default class WeaponModel extends base {