增加bika修改图片质量
This commit is contained in:
20
apps/bika.js
20
apps/bika.js
@@ -32,6 +32,10 @@ export class newBika extends plugin {
|
||||
{
|
||||
reg: `#?${Prefix}(详情|细节)(.*)`,
|
||||
fnc: 'comicDetail'
|
||||
},
|
||||
{
|
||||
reg: `#?${Prefix}修改图片质量(.*)`,
|
||||
fnc: 'imageQuality'
|
||||
}
|
||||
]
|
||||
|
||||
@@ -77,6 +81,22 @@ export class newBika extends plugin {
|
||||
common.getRecallsendMsg(e, msg, { oneMsg: true })
|
||||
}
|
||||
|
||||
/** 图片质量 */
|
||||
async imageQuality (e) {
|
||||
let quality = e.msg.match(new RegExp(`#?${Prefix}修改图片质量(.*)`))[2]
|
||||
let imageQualityType = {
|
||||
低质量: 'low',
|
||||
中等质量: 'medium',
|
||||
高质量: 'high',
|
||||
原图: 'original'
|
||||
}
|
||||
if (!imageQualityType[quality] && !Object.values(imageQualityType).includes(quality)) return e.reply(`错误参数,支持的参数为${Object.keys(imageQualityType).join(',')}`)
|
||||
let type = imageQualityType[quality] ?? quality
|
||||
await redis.set('yenai:bika:imageQuality', type)
|
||||
Bika.imageQuality = type
|
||||
e.reply(`✅ 已将bika图片质量修改为${quality}(${type})`)
|
||||
}
|
||||
|
||||
/** 权限判定 */
|
||||
handlePermission () {
|
||||
let { sesepro } = Config.getGroup(this.e.group_id)
|
||||
|
||||
@@ -7,12 +7,17 @@ export default new (class {
|
||||
constructor () {
|
||||
this.domain = 'http://api.liaobiao.top/api/bika'
|
||||
this.imgproxy = 'https://proxy.liaobiao.top/'
|
||||
this.imageQuality = 'original'
|
||||
this.imageQuality = 'medium'
|
||||
this.hearder = {
|
||||
headers: {
|
||||
'x-image-quality': this.imageQuality
|
||||
}
|
||||
}
|
||||
this.init()
|
||||
}
|
||||
|
||||
async init () {
|
||||
this.imageQuality = await redis.get('yenai:bika:imageQuality') ?? 'medium'
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user