mirror of
https://github.com/LLOneBot/LLOneBot.git
synced 2024-11-22 01:56:33 +00:00
feat: FriendAddNotice
This commit is contained in:
@@ -3,11 +3,25 @@ import { OB11Constructor } from '../../constructor'
|
||||
import { friends } from '../../../common/data'
|
||||
import BaseAction from '../BaseAction'
|
||||
import { ActionName } from '../types'
|
||||
import { NTQQFriendApi } from '../../../ntqqapi/api'
|
||||
import { log } from '../../../common/utils'
|
||||
|
||||
class GetFriendList extends BaseAction<null, OB11User[]> {
|
||||
interface Payload{
|
||||
no_cache: boolean | string
|
||||
}
|
||||
|
||||
class GetFriendList extends BaseAction<Payload, OB11User[]> {
|
||||
actionName = ActionName.GetFriendList
|
||||
|
||||
protected async _handle(payload: null) {
|
||||
protected async _handle(payload: Payload) {
|
||||
if (friends.length === 0 || payload?.no_cache === true || payload?.no_cache === 'true') {
|
||||
const _friends = await NTQQFriendApi.getFriends(true)
|
||||
// log('强制刷新好友列表,结果: ', _friends)
|
||||
if (_friends.length > 0) {
|
||||
friends.length = 0
|
||||
friends.push(..._friends)
|
||||
}
|
||||
}
|
||||
return OB11Constructor.friends(friends)
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user