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 { generateMessageID } from "../Utils";
|
||||||
import { SocketConfig, GroupMetadata, ParticipantAction } from "../Types";
|
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";
|
import { makeSocket } from "./socket";
|
||||||
|
|
||||||
export const makeGroupsSocket = (config: SocketConfig) => {
|
export const makeGroupsSocket = (config: SocketConfig) => {
|
||||||
@@ -196,7 +196,7 @@ export const extractGroupMetadata = (result: BinaryNode) => {
|
|||||||
id: groupId,
|
id: groupId,
|
||||||
subject: group.attrs.subject,
|
subject: group.attrs.subject,
|
||||||
creation: +group.attrs.creation,
|
creation: +group.attrs.creation,
|
||||||
owner: group.attrs.creator,
|
owner: group.attrs.creator ? jidNormalizedUser(group.attrs.creator) : undefined,
|
||||||
desc,
|
desc,
|
||||||
descId,
|
descId,
|
||||||
restrict: !!getBinaryNodeChild(result, 'locked'),
|
restrict: !!getBinaryNodeChild(result, 'locked'),
|
||||||
|
|||||||
@@ -274,9 +274,7 @@ export const makeMessagesRecvSocket = (config: SocketConfig) => {
|
|||||||
|
|
||||||
result.messageStubType = WAMessageStubType.GROUP_CREATE
|
result.messageStubType = WAMessageStubType.GROUP_CREATE
|
||||||
result.messageStubParameters = [metadata.subject]
|
result.messageStubParameters = [metadata.subject]
|
||||||
result.key = {
|
result.key = { participant: metadata.owner }
|
||||||
participant: jidNormalizedUser(metadata.owner)
|
|
||||||
}
|
|
||||||
|
|
||||||
ev.emit('chats.upsert', [{
|
ev.emit('chats.upsert', [{
|
||||||
id: metadata.id,
|
id: metadata.id,
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ export type ParticipantAction = 'add' | 'remove' | 'promote' | 'demote'
|
|||||||
|
|
||||||
export interface GroupMetadata {
|
export interface GroupMetadata {
|
||||||
id: string
|
id: string
|
||||||
owner: string
|
owner: string | undefined
|
||||||
subject: string
|
subject: string
|
||||||
creation: number
|
creation: number
|
||||||
desc?: string
|
desc?: string
|
||||||
|
|||||||
Reference in New Issue
Block a user