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