mirror of
https://github.com/LLOneBot/LLOneBot.git
synced 2024-11-22 01:56:33 +00:00
feat
This commit is contained in:
parent
277e418cf3
commit
3dc9940ac9
@ -293,7 +293,7 @@ export class NTQQGroupApi extends Service {
|
||||
cmdCB: (payload, result) => payload.fileInfo.reqId === result
|
||||
}
|
||||
)
|
||||
return data.fileInfo.item
|
||||
return data.fileInfo
|
||||
}
|
||||
|
||||
async publishGroupBulletin(groupCode: string, req: PublishGroupBulletinReq) {
|
||||
|
@ -1,11 +1,11 @@
|
||||
import { BaseAction, Schema } from '../BaseAction'
|
||||
import { ActionName } from '../types'
|
||||
import { OB11GroupFile, OB11GroupFileFolder } from '@/onebot11/types'
|
||||
import { OnGroupFileInfoUpdateParams } from '@/ntqqapi/types'
|
||||
|
||||
interface Payload {
|
||||
group_id: string | number
|
||||
group_id: number | string
|
||||
folder_id: string
|
||||
file_count: string | number
|
||||
}
|
||||
|
||||
interface Response {
|
||||
@ -17,19 +17,27 @@ export class GetGroupFilesByFolder extends BaseAction<Payload, Response> {
|
||||
actionName = ActionName.GoCQHTTP_GetGroupFilesByFolder
|
||||
payloadSchema = Schema.object({
|
||||
group_id: Schema.union([Number, String]).required(),
|
||||
folder_id: Schema.string().required(),
|
||||
file_count: Schema.union([Number, String]).default(50)
|
||||
folder_id: Schema.string().required()
|
||||
})
|
||||
|
||||
async _handle(payload: Payload) {
|
||||
const data = await this.ctx.ntGroupApi.getGroupFileList(payload.group_id.toString(), {
|
||||
sortType: 1,
|
||||
fileCount: +payload.file_count,
|
||||
startIndex: 0,
|
||||
sortOrder: 2,
|
||||
showOnlinedocFolder: 0,
|
||||
folderId: payload.folder_id
|
||||
})
|
||||
const groupId = payload.group_id.toString()
|
||||
const data: OnGroupFileInfoUpdateParams['item'] = []
|
||||
|
||||
let nextIndex: number | undefined
|
||||
while (nextIndex !== 0) {
|
||||
const res = await this.ctx.ntGroupApi.getGroupFileList(groupId, {
|
||||
sortType: 1,
|
||||
fileCount: 100,
|
||||
startIndex: nextIndex ?? 0,
|
||||
sortOrder: 2,
|
||||
showOnlinedocFolder: 0,
|
||||
folderId: payload.folder_id
|
||||
})
|
||||
data.push(...res.item)
|
||||
nextIndex = res.nextIndex
|
||||
}
|
||||
|
||||
return {
|
||||
files: data.filter(item => item.fileInfo)
|
||||
.map(item => {
|
||||
|
@ -1,10 +1,10 @@
|
||||
import { BaseAction, Schema } from '../BaseAction'
|
||||
import { ActionName } from '../types'
|
||||
import { OB11GroupFile, OB11GroupFileFolder } from '../../types'
|
||||
import { OnGroupFileInfoUpdateParams } from '@/ntqqapi/types'
|
||||
|
||||
interface Payload {
|
||||
group_id: string | number
|
||||
file_count: string | number
|
||||
group_id: number | string
|
||||
}
|
||||
|
||||
interface Response {
|
||||
@ -15,18 +15,26 @@ interface Response {
|
||||
export class GetGroupRootFiles extends BaseAction<Payload, Response> {
|
||||
actionName = ActionName.GoCQHTTP_GetGroupRootFiles
|
||||
payloadSchema = Schema.object({
|
||||
group_id: Schema.union([Number, String]).required(),
|
||||
file_count: Schema.union([Number, String]).default(50),
|
||||
group_id: Schema.union([Number, String]).required()
|
||||
})
|
||||
|
||||
async _handle(payload: Payload) {
|
||||
const data = await this.ctx.ntGroupApi.getGroupFileList(payload.group_id.toString(), {
|
||||
sortType: 1,
|
||||
fileCount: +payload.file_count,
|
||||
startIndex: 0,
|
||||
sortOrder: 2,
|
||||
showOnlinedocFolder: 0,
|
||||
})
|
||||
const groupId = payload.group_id.toString()
|
||||
const data: OnGroupFileInfoUpdateParams['item'] = []
|
||||
|
||||
let nextIndex: number | undefined
|
||||
while (nextIndex !== 0) {
|
||||
const res = await this.ctx.ntGroupApi.getGroupFileList(groupId, {
|
||||
sortType: 1,
|
||||
fileCount: 100,
|
||||
startIndex: nextIndex ?? 0,
|
||||
sortOrder: 2,
|
||||
showOnlinedocFolder: 0,
|
||||
})
|
||||
data.push(...res.item)
|
||||
nextIndex = res.nextIndex
|
||||
}
|
||||
|
||||
return {
|
||||
files: data.filter(item => item.fileInfo)
|
||||
.map(item => {
|
||||
|
@ -109,25 +109,19 @@ export namespace OB11Entities {
|
||||
let name: string | undefined
|
||||
if (element.textElement.atType == AtType.atAll) {
|
||||
qq = 'all'
|
||||
}
|
||||
else {
|
||||
const { atNtUid, content } = element.textElement
|
||||
let atQQ = element.textElement.atUid
|
||||
if (!atQQ || atQQ === '0') {
|
||||
const atMember = await ctx.ntGroupApi.getGroupMember(msg.peerUin, atNtUid)
|
||||
if (atMember) {
|
||||
atQQ = atMember.uin
|
||||
}
|
||||
}
|
||||
if (atQQ) {
|
||||
qq = atQQ
|
||||
name = content.replace('@', '')
|
||||
} else {
|
||||
const { atNtUid, atUid, content } = element.textElement
|
||||
if (atUid && atUid !== '0') {
|
||||
qq = atUid
|
||||
} else {
|
||||
qq = await ctx.ntUserApi.getUinByUid(atNtUid)
|
||||
}
|
||||
name = content.replace('@', '')
|
||||
}
|
||||
messageSegment = {
|
||||
type: OB11MessageDataType.at,
|
||||
data: {
|
||||
qq: qq!,
|
||||
qq,
|
||||
name
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user