mirror of
https://github.com/FranP-code/Baileys.git
synced 2025-10-13 00:32:22 +00:00
Add join group by groupInviteMessage (#1355)
* Add join group by groupInviteMessage * Add join group by groupInviteMessage * Fix typo
This commit is contained in:
committed by
GitHub
parent
4b6e97cf93
commit
eb8f8e0d72
@@ -2,6 +2,7 @@ import { GroupMetadata, ParticipantAction, SocketConfig } from '../Types'
|
||||
import { generateMessageID } from '../Utils'
|
||||
import { BinaryNode, getBinaryNodeChild, getBinaryNodeChildren, jidEncode, jidNormalizedUser } from '../WABinary'
|
||||
import { makeSocket } from './socket'
|
||||
import { proto } from '../../WAProto'
|
||||
|
||||
export const makeGroupsSocket = (config: SocketConfig) => {
|
||||
const sock = makeSocket(config)
|
||||
@@ -134,6 +135,13 @@ export const makeGroupsSocket = (config: SocketConfig) => {
|
||||
const result = getBinaryNodeChild(results, 'group')
|
||||
return result.attrs.jid
|
||||
},
|
||||
groupAcceptInviteV4: async(jid: string, inviteMessage: proto.IGroupInviteMessage) => {
|
||||
const results = await groupQuery(inviteMessage.groupJid, 'set', [{ tag: 'accept', attrs: {
|
||||
code: inviteMessage.inviteCode,
|
||||
expiration: inviteMessage.inviteExpiration.toString(),
|
||||
admin: jid} }])
|
||||
return results.attrs.from;
|
||||
},
|
||||
groupToggleEphemeral: async(jid: string, ephemeralExpiration: number) => {
|
||||
const content: BinaryNode = ephemeralExpiration ?
|
||||
{ tag: 'ephemeral', attrs: { expiration: ephemeralExpiration.toString() } } :
|
||||
|
||||
Reference in New Issue
Block a user