Miao-Yunzai/apps/event/friend.ts

39 lines
685 B
TypeScript
Raw Normal View History

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