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 quit 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: 'notice',
|
|
|
|
|
dsc: '自动退群',
|
|
|
|
|
*/
|
2024-06-12 22:36:39 +08:00
|
|
|
|
super()
|
|
|
|
|
this.event = 'notice.group.increase'
|
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() {
|
|
|
|
|
if (this.e.user_id != this.e.bot.uin) return
|
|
|
|
|
/**
|
2024-06-17 22:52:15 +08:00
|
|
|
|
*
|
2024-06-11 21:03:42 +08:00
|
|
|
|
*/
|
|
|
|
|
let other = cfg.other
|
|
|
|
|
/**
|
2024-06-17 22:52:15 +08:00
|
|
|
|
*
|
2024-06-11 21:03:42 +08:00
|
|
|
|
*/
|
|
|
|
|
if (other.autoQuit <= 0) return
|
|
|
|
|
/**
|
|
|
|
|
* 判断主人,主人邀请不退群
|
|
|
|
|
*/
|
|
|
|
|
let gl = await this.e.group.getMemberMap()
|
|
|
|
|
for (let qq of cfg.masterQQ) {
|
|
|
|
|
if (gl.has(Number(qq))) {
|
|
|
|
|
logger.mark(`[主人拉群] ${this.e.group_id}`)
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
/**
|
|
|
|
|
* 自动退群
|
|
|
|
|
*/
|
|
|
|
|
if (Array.from(gl).length <= other.autoQuit && !this.e.group.is_owner) {
|
|
|
|
|
/**
|
2024-06-17 22:52:15 +08:00
|
|
|
|
*
|
2024-06-11 21:03:42 +08:00
|
|
|
|
*/
|
|
|
|
|
await this.e.reply('禁止拉群,已自动退出')
|
|
|
|
|
/**
|
2024-06-17 22:52:15 +08:00
|
|
|
|
*
|
2024-06-11 21:03:42 +08:00
|
|
|
|
*/
|
|
|
|
|
logger.mark(`[自动退群] ${this.e.group_id}`)
|
|
|
|
|
/**
|
2024-06-17 22:52:15 +08:00
|
|
|
|
*
|
2024-06-11 21:03:42 +08:00
|
|
|
|
*/
|
|
|
|
|
setTimeout(() => {
|
|
|
|
|
/**
|
2024-06-17 22:52:15 +08:00
|
|
|
|
*
|
2024-06-11 21:03:42 +08:00
|
|
|
|
*/
|
|
|
|
|
this.e.group.quit()
|
|
|
|
|
}, 2000)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|