|
import plugin from '../../lib/plugins/plugin.js'; |
|
import { segment } from "oicq"; |
|
import { FrameToFrame, createEvent } from "../py-plugin/core/client/client.js"; |
|
import { imageUrlToBuffer } from "../py-plugin/core/util/transform.js"; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
export class newcomer extends plugin { |
|
constructor() { |
|
super({ |
|
name: '欢迎新人', |
|
dsc: '新人入群欢迎', |
|
|
|
event: 'notice.group.increase', |
|
priority: 4000 |
|
}) |
|
} |
|
|
|
|
|
async accept() { |
|
|
|
|
|
let msg = '欢迎新人!'; |
|
|
|
let cd = 30; |
|
|
|
if (this.e.user_id == Bot.uin) { return } |
|
|
|
|
|
let key = `Yz:newcomers:${this.e.group_id}`; |
|
if (await redis.get(key)) { return } |
|
redis.set(key, '1', { EX: cd }); |
|
|
|
|
|
await this.reply([ |
|
segment.at(this.e.user_id), |
|
|
|
msg |
|
]) |
|
|
|
|
|
let increasemem = ["_jiujiu", "_tightly", "_anyasuki", "_petpet", "_pat", "_play"]; |
|
let imgbf = await imageUrlToBuffer(`https://q1.qlogo.cn/g?b=qq&s=0&nk=${this.e.user_id}`); |
|
FrameToFrame({ |
|
_package: "petpet", |
|
_handler: increasemem[Math.floor(Math.random() * increasemem.length)], |
|
params: { |
|
|
|
event: { |
|
|
|
sender: { |
|
qq: this.e.user_id.toString(), |
|
name: "233", |
|
card: "233", |
|
sex: "233", |
|
age: "233", |
|
area: "233", |
|
level: "233", |
|
role: "233", |
|
title: "233", |
|
}, |
|
atList: [{ |
|
qq: this.e.user_id.toString(), |
|
name: this.e.user_id.toString(), |
|
}], |
|
imageList: [imgbf], |
|
msg: "", |
|
group: null |
|
}, |
|
message: "" |
|
}, |
|
onData: (error, response) => { |
|
if (error) { |
|
console.error(error.details); |
|
} else { |
|
this.reply(segment.image(response.image)); |
|
} |
|
}, |
|
}); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
} |
|
|
|
export class outNotice extends plugin { |
|
constructor() { |
|
super({ |
|
name: '退群通知', |
|
dsc: 'xxx永远离开了我们', |
|
event: 'notice.group.decrease' |
|
}) |
|
|
|
|
|
this.tips = '永远离开了我们。。' |
|
} |
|
|
|
async accept() { |
|
if (this.e.user_id == Bot.uin) { |
|
return |
|
} |
|
let name, msg; |
|
if (this.e.member) { |
|
name = this.e.member.card || this.e.member.nickname |
|
} |
|
|
|
if (name) { |
|
msg = `${name}(${this.e.user_id}) ${this.tips}` |
|
} else { |
|
msg = `${this.e.user_id} ${this.tips}` |
|
} |
|
|
|
|
|
|
|
|
|
let decreasemem = ["_hammer", "_thump", "_rip", "_eat"]; |
|
let imgbf = await imageUrlToBuffer(`https://q1.qlogo.cn/g?b=qq&s=0&nk=${this.e.user_id}`); |
|
FrameToFrame({ |
|
_package: "petpet", |
|
_handler: decreasemem[Math.floor(Math.random() * decreasemem.length)], |
|
params: { |
|
|
|
event: { |
|
|
|
sender: { |
|
qq: this.e.user_id.toString(), |
|
name: "233", |
|
card: "233", |
|
sex: "233", |
|
age: "233", |
|
area: "233", |
|
level: "233", |
|
role: "233", |
|
title: "233", |
|
}, |
|
atList: [{ |
|
qq: this.e.user_id.toString(), |
|
name: this.e.user_id.toString(), |
|
}], |
|
imageList: [imgbf], |
|
msg: "", |
|
group: null |
|
}, |
|
message: "缅怀" |
|
}, |
|
onData: (error, response) => { |
|
if (error) { |
|
console.error(error.details); |
|
} else { |
|
this.reply(segment.image(response.image)); |
|
} |
|
}, |
|
}); |
|
|
|
|
|
logger.mark(`[退出通知]${this.e.logText} ${msg}`); |
|
await this.reply(msg); |
|
} |
|
} |
|
|