d08a09c35f
* feat: add inbound username support and USync username protocol Aligns with Baileys upstream PR #2480. WhatsApp is rolling out an inbound username field that maps to the user's LID. This change is purely additive — it captures and propagates the new optional field through types, decoders, USync queries, and group/contact events. Skipped intentionally to preserve InfiniteAPI's LID/PN customization: - handleGroupNotification in messages-recv.ts (custom LID->PN flow on groups.upsert / participants.map). Username for these specific events still flows via process-message's emitParticipantsUpdate (reads message.key.participantUsername added in decode-wa-message). Carousel/buttons code (messages.ts, messages-send.ts) untouched. Co-Authored-By: Renato Alcara
75 lines
2.2 KiB
TypeScript
75 lines
2.2 KiB
TypeScript
import type { Contact } from './Contact'
|
|
import type { WAMessageAddressingMode } from './Message'
|
|
|
|
export type GroupParticipant = Contact & {
|
|
isAdmin?: boolean
|
|
isSuperAdmin?: boolean
|
|
admin?: 'admin' | 'superadmin' | null
|
|
}
|
|
|
|
export type ParticipantAction = 'add' | 'remove' | 'promote' | 'demote' | 'modify'
|
|
|
|
export type RequestJoinAction = 'created' | 'revoked' | 'rejected'
|
|
|
|
export type RequestJoinMethod = 'invite_link' | 'linked_group_join' | 'non_admin_add' | undefined
|
|
|
|
export interface GroupMetadata {
|
|
id: string
|
|
notify?: string
|
|
/** group uses 'lid' or 'pn' to send messages */
|
|
addressingMode?: WAMessageAddressingMode
|
|
owner: string | undefined
|
|
ownerPn?: string | undefined
|
|
ownerUsername?: string | undefined
|
|
owner_country_code?: string | undefined
|
|
subject: string
|
|
/** group subject owner */
|
|
subjectOwner?: string
|
|
subjectOwnerPn?: string
|
|
subjectOwnerUsername?: string
|
|
/** group subject modification date */
|
|
subjectTime?: number
|
|
creation?: number
|
|
desc?: string
|
|
descOwner?: string
|
|
descOwnerPn?: string
|
|
descOwnerUsername?: string
|
|
descId?: string
|
|
descTime?: number
|
|
/** if this group is part of a community, it returns the jid of the community to which it belongs */
|
|
linkedParent?: string
|
|
/** is set when the group only allows admins to change group settings */
|
|
restrict?: boolean
|
|
/** is set when the group only allows admins to write messages */
|
|
announce?: boolean
|
|
/** is set when the group also allows members to add participants */
|
|
memberAddMode?: boolean
|
|
/** Request approval to join the group */
|
|
joinApprovalMode?: boolean
|
|
/** is this a community */
|
|
isCommunity?: boolean
|
|
/** is this the announce of a community */
|
|
isCommunityAnnounce?: boolean
|
|
/** number of group participants */
|
|
size?: number
|
|
// Baileys modified array
|
|
participants: GroupParticipant[]
|
|
ephemeralDuration?: number
|
|
inviteCode?: string
|
|
/** the person who added you to group or changed some setting in group */
|
|
author?: string
|
|
authorPn?: string
|
|
authorUsername?: string
|
|
}
|
|
|
|
export interface WAGroupCreateResponse {
|
|
status: number
|
|
gid?: string
|
|
participants?: [{ [key: string]: {} }]
|
|
}
|
|
|
|
export interface GroupModificationResponse {
|
|
status: number
|
|
participants?: { [key: string]: {} }
|
|
}
|