mirror of
https://github.com/LLOneBot/LLOneBot.git
synced 2024-11-22 01:56:33 +00:00
refactor
This commit is contained in:
@@ -2,7 +2,6 @@ import BaseAction from '../BaseAction'
|
||||
import { OB11User } from '../../types'
|
||||
import { OB11Constructor } from '../../constructor'
|
||||
import { ActionName } from '../types'
|
||||
import { NTQQFriendApi } from '@/ntqqapi/api'
|
||||
import { getBuildVersion } from '@/common/utils/QQBasicInfo'
|
||||
|
||||
interface Payload {
|
||||
@@ -15,9 +14,9 @@ export class GetFriendList extends BaseAction<Payload, OB11User[]> {
|
||||
protected async _handle(payload: Payload) {
|
||||
const refresh = payload?.no_cache === true || payload?.no_cache === 'true'
|
||||
if (getBuildVersion() >= 26702) {
|
||||
return OB11Constructor.friendsV2(await NTQQFriendApi.getBuddyV2(refresh))
|
||||
return OB11Constructor.friendsV2(await this.ctx.ntFriendApi.getBuddyV2(refresh))
|
||||
}
|
||||
return OB11Constructor.friends(await NTQQFriendApi.getFriends(refresh))
|
||||
return OB11Constructor.friends(await this.ctx.ntFriendApi.getFriends(refresh))
|
||||
}
|
||||
}
|
||||
|
||||
@@ -28,7 +27,7 @@ export class GetFriendWithCategory extends BaseAction<void, any> {
|
||||
protected async _handle(payload: void) {
|
||||
if (getBuildVersion() >= 26702) {
|
||||
//全新逻辑
|
||||
return OB11Constructor.friendsV2(await NTQQFriendApi.getBuddyV2ExWithCate(true))
|
||||
return OB11Constructor.friendsV2(await this.ctx.ntFriendApi.getBuddyV2ExWithCate(true))
|
||||
} else {
|
||||
throw new Error('this ntqq version not support, must be 26702 or later')
|
||||
}
|
||||
|
Reference in New Issue
Block a user