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-17 22:52:15 +08:00
|
|
|
|
*
|
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
|
|
|
|
/**
|
2024-06-17 22:52:15 +08:00
|
|
|
|
*
|
2024-06-11 21:03:42 +08:00
|
|
|
|
*/
|
|
|
|
|
constructor() {
|
|
|
|
|
/**
|
|
|
|
|
*
|
|
|
|
|
name: 'invite',
|
|
|
|
|
dsc: '主人邀请自动进群',
|
|
|
|
|
*/
|
2024-06-12 22:36:39 +08:00
|
|
|
|
super()
|
2024-06-17 22:52:15 +08:00
|
|
|
|
this.event = 'request.group.invite'
|
2024-06-11 21:03:42 +08:00
|
|
|
|
}
|
|
|
|
|
/**
|
2024-06-17 22:52:15 +08:00
|
|
|
|
*
|
|
|
|
|
* @returns
|
2024-06-11 21:03:42 +08:00
|
|
|
|
*/
|
|
|
|
|
async accept() {
|
2024-06-17 22:52:15 +08:00
|
|
|
|
if (/group/.test(this.event)) {
|
2024-06-15 11:18:45 +08:00
|
|
|
|
this.e.isGroup = true
|
|
|
|
|
}
|
2024-06-17 22:52:15 +08:00
|
|
|
|
if (!this.e.isGroup) return
|
2024-06-15 11:18:45 +08:00
|
|
|
|
//
|
2024-06-11 21:03:42 +08:00
|
|
|
|
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)
|
2024-06-17 22:52:15 +08:00
|
|
|
|
this.e.bot
|
|
|
|
|
.sendPrivateMsg(this.e.user_id, `已同意加群:${this.e.group_name}`)
|
|
|
|
|
.catch(err => {
|
|
|
|
|
logger.error(err)
|
|
|
|
|
})
|
2024-06-11 21:03:42 +08:00
|
|
|
|
}
|
|
|
|
|
}
|