2024-06-12 10:47:19 +08:00
|
|
|
import { Plugin, segment } from 'yunzai/core'
|
2024-06-11 21:03:42 +08:00
|
|
|
/**
|
|
|
|
*
|
|
|
|
*/
|
2024-06-12 10:47:19 +08:00
|
|
|
export class newcomer extends Plugin {
|
2024-06-11 21:03:42 +08:00
|
|
|
/**
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
constructor() {
|
|
|
|
/**
|
|
|
|
name: '欢迎新人',
|
|
|
|
dsc: '新人入群欢迎',
|
|
|
|
*/
|
2024-06-12 22:36:39 +08:00
|
|
|
super()
|
|
|
|
this.event = 'notice.group.increase'
|
|
|
|
this.priority = 5000
|
2024-06-11 21:03:42 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 接受到消息都会执行一次
|
|
|
|
* @returns
|
|
|
|
*/
|
|
|
|
async accept() {
|
|
|
|
/** 定义入群欢迎内容 */
|
|
|
|
let msg = '欢迎新人!'
|
|
|
|
/** 冷却cd 30s */
|
|
|
|
let cd = 30
|
|
|
|
if (this.e.user_id == this.e.bot.uin) return
|
|
|
|
/** cd */
|
|
|
|
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),
|
|
|
|
// segment.image(),
|
|
|
|
msg
|
|
|
|
])
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|