37 lines
800 B
TypeScript
37 lines
800 B
TypeScript
|
||
import { ConfigController as cfg } from 'yunzai/config'
|
||
import { Plugin } from 'yunzai/core'
|
||
/**
|
||
*
|
||
*/
|
||
export class invite extends Plugin {
|
||
/**
|
||
*
|
||
*/
|
||
constructor() {
|
||
/**
|
||
*
|
||
name: 'invite',
|
||
dsc: '主人邀请自动进群',
|
||
*/
|
||
super({
|
||
event: 'request.group.invite'
|
||
})
|
||
}
|
||
/**
|
||
*
|
||
* @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)
|
||
})
|
||
}
|
||
}
|