mirror of
https://github.com/LLOneBot/LLOneBot.git
synced 2024-11-22 01:56:33 +00:00
feat: get_group_file_system_info
API
This commit is contained in:
parent
0fe725eb32
commit
364dfe8b93
src
ntqqapi
onebot11/action
@ -325,4 +325,18 @@ export class NTQQGroupApi extends Service {
|
|||||||
)
|
)
|
||||||
return data.infos
|
return data.infos
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async getGroupFileCount(groupId: string) {
|
||||||
|
return await invoke(
|
||||||
|
'nodeIKernelRichMediaService/batchGetGroupFileCount',
|
||||||
|
[{ groupIds: [groupId] }]
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
async getGroupFileSpace(groupId: string) {
|
||||||
|
return await invoke(
|
||||||
|
'nodeIKernelRichMediaService/getGroupSpace',
|
||||||
|
[{ groupId }]
|
||||||
|
)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -39,5 +39,21 @@ export interface NodeIKernelRichMediaService {
|
|||||||
failFileIdList: Array<unknown>
|
failFileIdList: Array<unknown>
|
||||||
}
|
}
|
||||||
}>
|
}>
|
||||||
|
|
||||||
|
batchGetGroupFileCount(groupIds: string[]): Promise<GeneralCallResult & {
|
||||||
|
groupCodes: string[]
|
||||||
|
groupFileCounts: number[]
|
||||||
|
}>
|
||||||
|
|
||||||
|
getGroupSpace(groupId: string): Promise<GeneralCallResult & {
|
||||||
|
groupSpaceResult: {
|
||||||
|
retCode: number
|
||||||
|
retMsg: string
|
||||||
|
clientWording: string
|
||||||
|
totalSpace: string
|
||||||
|
usedSpace: string
|
||||||
|
allUpload: boolean
|
||||||
|
}
|
||||||
|
}>
|
||||||
}
|
}
|
||||||
|
|
||||||
|
32
src/onebot11/action/go-cqhttp/GetGroupFileSystemInfo.ts
Normal file
32
src/onebot11/action/go-cqhttp/GetGroupFileSystemInfo.ts
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
import { BaseAction, Schema } from '../BaseAction'
|
||||||
|
import { ActionName } from '../types'
|
||||||
|
|
||||||
|
interface Payload {
|
||||||
|
group_id: number | string
|
||||||
|
}
|
||||||
|
|
||||||
|
interface Response {
|
||||||
|
file_count: number
|
||||||
|
limit_count: number
|
||||||
|
used_space: number
|
||||||
|
total_space: number
|
||||||
|
}
|
||||||
|
|
||||||
|
export class GetGroupFileSystemInfo extends BaseAction<Payload, Response> {
|
||||||
|
actionName = ActionName.GoCQHTTP_GetGroupFileSystemInfo
|
||||||
|
payloadSchema = Schema.object({
|
||||||
|
group_id: Schema.union([Number, String]).required()
|
||||||
|
})
|
||||||
|
|
||||||
|
async _handle(payload: Payload) {
|
||||||
|
const groupId = payload.group_id.toString()
|
||||||
|
const { groupFileCounts } = await this.ctx.ntGroupApi.getGroupFileCount(groupId)
|
||||||
|
const { groupSpaceResult } = await this.ctx.ntGroupApi.getGroupFileSpace(groupId)
|
||||||
|
return {
|
||||||
|
file_count: groupFileCounts[0],
|
||||||
|
limit_count: 10000,
|
||||||
|
used_space: +groupSpaceResult.usedSpace,
|
||||||
|
total_space: +groupSpaceResult.totalSpace,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -76,6 +76,7 @@ import { DeleteFriend } from './go-cqhttp/DeleteFriend'
|
|||||||
import { OCRImage } from './go-cqhttp/OCRImage'
|
import { OCRImage } from './go-cqhttp/OCRImage'
|
||||||
import { GroupPoke } from './llonebot/GroupPoke'
|
import { GroupPoke } from './llonebot/GroupPoke'
|
||||||
import { FriendPoke } from './llonebot/FriendPoke'
|
import { FriendPoke } from './llonebot/FriendPoke'
|
||||||
|
import { GetGroupFileSystemInfo } from './go-cqhttp/GetGroupFileSystemInfo'
|
||||||
|
|
||||||
export function initActionMap(adapter: Adapter) {
|
export function initActionMap(adapter: Adapter) {
|
||||||
const actionHandlers = [
|
const actionHandlers = [
|
||||||
@ -157,6 +158,7 @@ export function initActionMap(adapter: Adapter) {
|
|||||||
new GetGroupNotice(adapter),
|
new GetGroupNotice(adapter),
|
||||||
new DeleteFriend(adapter),
|
new DeleteFriend(adapter),
|
||||||
new OCRImage(adapter),
|
new OCRImage(adapter),
|
||||||
|
new GetGroupFileSystemInfo(adapter),
|
||||||
]
|
]
|
||||||
const actionMap = new Map<string, BaseAction<any, unknown>>()
|
const actionMap = new Map<string, BaseAction<any, unknown>>()
|
||||||
for (const action of actionHandlers) {
|
for (const action of actionHandlers) {
|
||||||
|
@ -89,4 +89,5 @@ export enum ActionName {
|
|||||||
GoCQHTTP_GetGroupNotice = '_get_group_notice',
|
GoCQHTTP_GetGroupNotice = '_get_group_notice',
|
||||||
GoCQHTTP_DeleteFriend = 'delete_friend',
|
GoCQHTTP_DeleteFriend = 'delete_friend',
|
||||||
GoCQHTTP_OCRImage = 'ocr_image',
|
GoCQHTTP_OCRImage = 'ocr_image',
|
||||||
|
GoCQHTTP_GetGroupFileSystemInfo = 'get_group_file_system_info',
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user