Miao-Yunzai/apps/friend.ts

40 lines
692 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'
import { sleep } from 'yunzai/utils'
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 friend extends Plugin {
2024-06-11 21:03:42 +08:00
/**
*
*/
constructor() {
/**
*
name: 'autoFriend',
dsc: '自动同意好友',
*/
2024-06-12 22:36:39 +08:00
super()
this.event = 'request.friend'
2024-06-11 21:03:42 +08:00
}
/**
*
*/
async accept() {
/**
*
*/
if (this.e.sub_type == 'add' || this.e.sub_type == 'single') {
/**
*
*/
if (cfg.other.autoFriend == 1) {
logger.mark(`[自动同意][添加好友] ${this.e.user_id}`)
await sleep(2000)
this.e.approve(true)
}
}
}
}