mirror of
https://github.com/FranP-code/Baileys.git
synced 2025-10-13 00:32:22 +00:00
fix: typeerror on some group create
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
import { generateMessageID } from "../Utils";
|
||||
import { SocketConfig, GroupMetadata, ParticipantAction } from "../Types";
|
||||
import { BinaryNode, getBinaryNodeChild, getBinaryNodeChildren, jidEncode } from "../WABinary";
|
||||
import { BinaryNode, getBinaryNodeChild, getBinaryNodeChildren, jidEncode, jidNormalizedUser } from "../WABinary";
|
||||
import { makeSocket } from "./socket";
|
||||
|
||||
export const makeGroupsSocket = (config: SocketConfig) => {
|
||||
@@ -196,7 +196,7 @@ export const extractGroupMetadata = (result: BinaryNode) => {
|
||||
id: groupId,
|
||||
subject: group.attrs.subject,
|
||||
creation: +group.attrs.creation,
|
||||
owner: group.attrs.creator,
|
||||
owner: group.attrs.creator ? jidNormalizedUser(group.attrs.creator) : undefined,
|
||||
desc,
|
||||
descId,
|
||||
restrict: !!getBinaryNodeChild(result, 'locked'),
|
||||
|
||||
@@ -274,9 +274,7 @@ export const makeMessagesRecvSocket = (config: SocketConfig) => {
|
||||
|
||||
result.messageStubType = WAMessageStubType.GROUP_CREATE
|
||||
result.messageStubParameters = [metadata.subject]
|
||||
result.key = {
|
||||
participant: jidNormalizedUser(metadata.owner)
|
||||
}
|
||||
result.key = { participant: metadata.owner }
|
||||
|
||||
ev.emit('chats.upsert', [{
|
||||
id: metadata.id,
|
||||
|
||||
@@ -6,7 +6,7 @@ export type ParticipantAction = 'add' | 'remove' | 'promote' | 'demote'
|
||||
|
||||
export interface GroupMetadata {
|
||||
id: string
|
||||
owner: string
|
||||
owner: string | undefined
|
||||
subject: string
|
||||
creation: number
|
||||
desc?: string
|
||||
|
||||
Reference in New Issue
Block a user