Miao-Yunzai/apps/invite.ts

36 lines
798 B
TypeScript
Raw Normal View History

2024-06-11 21:03:42 +08:00
2024-06-11 22:10:46 +08:00
import { ConfigController as cfg } from 'yunzai/config'
2024-06-12 10:47:19 +08:00
import { Plugin } from 'yunzai/core'
2024-06-11 21:03:42 +08:00
/**
*
*/
2024-06-12 10:47:19 +08:00
export class invite extends Plugin {
2024-06-11 21:03:42 +08:00
/**
*
*/
constructor() {
/**
*
name: 'invite',
dsc: '主人邀请自动进群',
*/
2024-06-12 22:36:39 +08:00
super()
this.event = 'request.group.invite'
2024-06-11 21:03:42 +08:00
}
/**
*
* @returns
*/
async accept() {
if (!cfg.masterQQ || !cfg.masterQQ.includes(String(this.e.user_id))) {
logger.mark(`[邀请加群]${this.e.group_name}${this.e.group_id}`)
return
}
logger.mark(`[主人邀请加群]${this.e.group_name}${this.e.group_id}`)
this.e.approve(true)
this.e.bot.sendPrivateMsg(this.e.user_id, `已同意加群:${this.e.group_name}`).catch((err) => {
logger.error(err)
})
}
}