feat: 搞群员头像

This commit is contained in:
ikechan8370 2023-02-25 21:25:39 +08:00
parent 29c8f9c19d
commit a46c69504a
2 changed files with 27 additions and 1 deletions

View file

@ -19,6 +19,10 @@ export class dalle extends plugin {
{
reg: '#(chatgpt|ChatGPT|dalle|Dalle)(修图|图片变形|改图)',
fnc: 'variation'
},
{
reg: '#(搞|改)(她|他)头像',
fnc: 'avatarVariation'
}
]
})
@ -113,4 +117,26 @@ export class dalle extends plugin {
await redis.del(`CHATGPT:VARIATION:${e.sender.user_id}`)
}
}
async avatarVariation (e) {
let ats = e.message.filter(m => m.type === 'at').filter(at => at.qq !== e.self_id)
if (ats.length > 0) {
for (let i = 0; i < ats.length; i++) {
let qq = ats[i].qq
let imgUrl = `https://q1.qlogo.cn/g?b=qq&s=0&nk=${qq}`
try {
let images = (await imageVariation(imgUrl)).map(image => segment.image(`base64://${image}`))
if (images.length > 1) {
this.reply(await makeForwardMsg(e, images))
} else {
this.reply(images[0], true)
}
} catch (err) {
console.log(err)
this.reply(`搞失败了: ${err}`, true)
await redis.del(`CHATGPT:VARIATION:${e.sender.user_id}`)
}
}
}
}
}

View file

@ -32,7 +32,7 @@ const defaultConfig = {
debug: true,
defaultTimeoutMs: 120000,
chromeTimeoutMS: 120000,
version: '2.0.0'
version: '2.0.1'
}
const _path = process.cwd()
let config = {}