Skip to content

Commit

Permalink
feat: 搞群员头像
Browse files Browse the repository at this point in the history
  • Loading branch information
ikechan8370 committed Feb 25, 2023
1 parent 29c8f9c commit a46c695
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 1 deletion.
26 changes: 26 additions & 0 deletions apps/draw.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@ export class dalle extends plugin {
{
reg: '#(chatgpt|ChatGPT|dalle|Dalle)(修图|图片变形|改图)',
fnc: 'variation'
},
{
reg: '#(搞|改)(她|他)头像',
fnc: 'avatarVariation'
}
]
})
Expand Down Expand Up @@ -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}`)
}
}
}
}
}
2 changes: 1 addition & 1 deletion utils/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {}
Expand Down

0 comments on commit a46c695

Please sign in to comment.