43 lines
794 B
TypeScript
43 lines
794 B
TypeScript
import { plugin, segment } from '#miao/core'
|
|
/**
|
|
*
|
|
*/
|
|
export class newcomer extends plugin {
|
|
/**
|
|
*
|
|
*/
|
|
constructor() {
|
|
/**
|
|
name: '欢迎新人',
|
|
dsc: '新人入群欢迎',
|
|
*/
|
|
super({
|
|
event: 'notice.group.increase',
|
|
priority: 5000
|
|
})
|
|
}
|
|
|
|
/**
|
|
* 接受到消息都会执行一次
|
|
* @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
|
|
])
|
|
}
|
|
}
|
|
|