!91 1.优化 #留影叙佳期 的处理 ; 2.优化 #今日素材 统一使用纯透明背景素材,提升观感

Merge pull request !91 from 曉K/master
This commit is contained in:
Kokomi 2023-09-01 18:19:04 +00:00 committed by Gitee
commit 6837b2017d
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
46 changed files with 22 additions and 21 deletions

View File

@ -3,25 +3,22 @@ import gsCfg from '../model/gsCfg.js'
import fetch from 'node-fetch'
export class takeBirthdayPhoto extends plugin {
constructor () {
constructor() {
super({
name: '留影叙佳期',
dsc: '留影叙佳期',
/** https://oicqjs.github.io/oicq/#events */
event: 'message',
priority: 5000,
rule: [
{
/** 命令正则匹配 */
reg: '#?留影叙佳期$',
/** 执行方法 */
reg: '#?(留影(叙佳期)?|((领)?((角色)?生日)(卡)?))$',
fnc: 'birthdaystar'
}
]
})
}
async birthdaystar (e) {
async birthdaystar(e) {
const { user_id } = e
const userInfo = await this.getCookie(user_id)
@ -46,28 +43,32 @@ export class takeBirthdayPhoto extends plugin {
e.reply('今天没有生日角色哦~', true)
return true
}
for (const role of birthday_star_list) {
await e.reply(`正在获取${role.name}的图片,请稍等~`, true)
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)
return true
} else {
await e.reply(`获取${role.name}的图片成功~`, true)
try {
for (const role of birthday_star_list) {
await e.reply(`正在获取${role.name}的图片,请稍等~`, true)
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)
return true
} else {
await e.reply(`获取${role.name}的图片成功~`, true)
}
}
} catch (error) {
await e.reply(`获取角色留影叙佳期图片失败可能是ck失效...`, true)
logger.error(error)
}
return true
}
async getCookie (user_id) {
async getCookie(user_id) {
const userInfo = ((await gsCfg.getBingCk()).ckQQ)[user_id]
return userInfo
}
async getEHK4EToken (ck, uid) {
async getEHK4EToken(ck, uid) {
const isCN = uid.toString().match(/^[125]/) ? true : false
const url = isCN ? 'https://api-takumi.mihoyo.com/common/badge/v1/login/account' : 'https://api-os-takumi.mihoyo.com/common/badge/v1/login/account'
const game_biz = isCN ? 'hk4e_cn' : 'hk4e_global'
@ -93,7 +94,7 @@ export class takeBirthdayPhoto extends plugin {
return e_hk4e_token
}
async getServer (uid) {
async getServer(uid) {
switch (String(uid)[0]) {
case '1':
case '2':
@ -112,7 +113,7 @@ export class takeBirthdayPhoto extends plugin {
return 'cn_gf01'
}
async getBirthdayStar (uid, e_hk4e_token, ck) {
async getBirthdayStar(uid, e_hk4e_token, ck) {
const cookie = `e_hk4e_token=${e_hk4e_token};${ck}`
const badge_region = await this.getServer(uid)
const isCN = uid.toString().match(/^[125]/) ? true : false
@ -124,7 +125,7 @@ export class takeBirthdayPhoto extends plugin {
return res.data.role
}
async getBirthdayStarImg (uid, e_hk4e_token, ck, role_id) {
async getBirthdayStarImg(uid, e_hk4e_token, ck, role_id) {
const cookie = `e_hk4e_token=${e_hk4e_token};${ck}`
const badge_region = await this.getServer(uid)
const isCN = uid.toString().match(/^[125]/) ? true : false

Binary file not shown.

Before

Width:  |  Height:  |  Size: 18 KiB

After

Width:  |  Height:  |  Size: 38 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 20 KiB

After

Width:  |  Height:  |  Size: 54 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 20 KiB

After

Width:  |  Height:  |  Size: 57 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 22 KiB

After

Width:  |  Height:  |  Size: 33 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 23 KiB

After

Width:  |  Height:  |  Size: 37 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 22 KiB

After

Width:  |  Height:  |  Size: 40 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 22 KiB

After

Width:  |  Height:  |  Size: 42 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 26 KiB

After

Width:  |  Height:  |  Size: 48 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 25 KiB

After

Width:  |  Height:  |  Size: 56 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 21 KiB

After

Width:  |  Height:  |  Size: 55 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 23 KiB

After

Width:  |  Height:  |  Size: 64 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 23 KiB

After

Width:  |  Height:  |  Size: 72 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 20 KiB

After

Width:  |  Height:  |  Size: 42 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 22 KiB

After

Width:  |  Height:  |  Size: 51 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 21 KiB

After

Width:  |  Height:  |  Size: 52 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 19 KiB

After

Width:  |  Height:  |  Size: 46 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 23 KiB

After

Width:  |  Height:  |  Size: 64 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 26 KiB

After

Width:  |  Height:  |  Size: 72 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 23 KiB

After

Width:  |  Height:  |  Size: 56 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 23 KiB

After

Width:  |  Height:  |  Size: 72 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 22 KiB

After

Width:  |  Height:  |  Size: 70 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 26 KiB

After

Width:  |  Height:  |  Size: 58 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 27 KiB

After

Width:  |  Height:  |  Size: 66 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 27 KiB

After

Width:  |  Height:  |  Size: 72 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 19 KiB

After

Width:  |  Height:  |  Size: 37 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 22 KiB

After

Width:  |  Height:  |  Size: 54 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 21 KiB

After

Width:  |  Height:  |  Size: 53 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 24 KiB

After

Width:  |  Height:  |  Size: 56 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 22 KiB

After

Width:  |  Height:  |  Size: 74 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 22 KiB

After

Width:  |  Height:  |  Size: 71 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 20 KiB

After

Width:  |  Height:  |  Size: 47 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 19 KiB

After

Width:  |  Height:  |  Size: 64 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 20 KiB

After

Width:  |  Height:  |  Size: 60 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 18 KiB

After

Width:  |  Height:  |  Size: 40 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 22 KiB

After

Width:  |  Height:  |  Size: 63 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 22 KiB

After

Width:  |  Height:  |  Size: 75 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 21 KiB

After

Width:  |  Height:  |  Size: 40 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 23 KiB

After

Width:  |  Height:  |  Size: 46 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 21 KiB

After

Width:  |  Height:  |  Size: 58 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 23 KiB

After

Width:  |  Height:  |  Size: 47 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 26 KiB

After

Width:  |  Height:  |  Size: 58 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 25 KiB

After

Width:  |  Height:  |  Size: 62 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 16 KiB

After

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 19 KiB

After

Width:  |  Height:  |  Size: 40 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 18 KiB

After

Width:  |  Height:  |  Size: 37 KiB