Docs: Script para scrapear documentacion de Baileys API
All checks were successful
build-and-deploy / build-and-deploy (push) Successful in 1m3s

- Script en scripts/scrape-baileys-docs.ts
- Genera docs/baileys-api-reference.md con 6433 lineas
- 79 secciones: interfaces, types, functions, variables, enums
- Referencia completa para desarrollo de mensajes
This commit is contained in:
2025-12-02 20:49:59 -06:00
parent ae8e4e37a7
commit 9f2f3ac510
19 changed files with 8117 additions and 0 deletions

View File

@@ -0,0 +1,57 @@
/**
* POST /api/debug/groups/participants
* Update group participants (add, remove, promote, demote)
*/
import { baileysManager } from '../../../services/baileys/manager'
type ParticipantAction = 'add' | 'remove' | 'promote' | 'demote'
export default defineEventHandler(async (event) => {
const username = getHeader(event, 'x-authentik-username')
if (!username) {
throw createError({ statusCode: 401, message: 'Unauthorized' })
}
const body = await readBody(event)
const { instanceId, jid, participants, action } = body as {
instanceId: string
jid: string
participants: string[]
action: ParticipantAction
}
if (!instanceId) {
throw createError({ statusCode: 400, message: 'instanceId is required' })
}
if (!jid) {
throw createError({ statusCode: 400, message: 'jid is required' })
}
if (!participants || !Array.isArray(participants) || participants.length === 0) {
throw createError({ statusCode: 400, message: 'participants array is required' })
}
const validActions: ParticipantAction[] = ['add', 'remove', 'promote', 'demote']
if (!action || !validActions.includes(action)) {
throw createError({
statusCode: 400,
message: `action must be one of: ${validActions.join(', ')}`
})
}
const socket = baileysManager.getSocket(instanceId)
if (!socket) {
throw createError({ statusCode: 400, message: 'Instance not connected' })
}
try {
const result = await socket.groupParticipantsUpdate(jid, participants, action)
return { success: true, data: result }
} catch (error) {
throw createError({
statusCode: 500,
message: `Failed to update participants: ${(error as Error).message}`
})
}
})