whatsapp-web.js 1.22.2-alpha.1 → 1.22.2-alpha.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/example.js +152 -1
- package/index.d.ts +163 -36
- package/package.json +1 -1
- package/src/Client.js +185 -29
- package/src/structures/GroupChat.js +180 -16
- package/src/structures/Location.js +32 -4
- package/src/structures/Message.js +15 -1
- package/src/util/Constants.js +1 -0
- package/src/util/Injected.js +257 -16
package/example.js
CHANGED
|
@@ -91,6 +91,78 @@ client.on('message', async msg => {
|
|
|
91
91
|
} catch (e) {
|
|
92
92
|
msg.reply('That invite code seems to be invalid.');
|
|
93
93
|
}
|
|
94
|
+
} else if (msg.body.startsWith('!addmembers')) {
|
|
95
|
+
const group = await msg.getChat();
|
|
96
|
+
const result = await group.addParticipants(['number1@c.us', 'number2@c.us', 'number3@c.us']);
|
|
97
|
+
/**
|
|
98
|
+
* The example of the {@link result} output:
|
|
99
|
+
*
|
|
100
|
+
* {
|
|
101
|
+
* 'number1@c.us': {
|
|
102
|
+
* code: 200,
|
|
103
|
+
* message: 'The participant was added successfully',
|
|
104
|
+
* isInviteV4Sent: false
|
|
105
|
+
* },
|
|
106
|
+
* 'number2@c.us': {
|
|
107
|
+
* code: 403,
|
|
108
|
+
* message: 'The participant can be added by sending private invitation only',
|
|
109
|
+
* isInviteV4Sent: true
|
|
110
|
+
* },
|
|
111
|
+
* 'number3@c.us': {
|
|
112
|
+
* code: 404,
|
|
113
|
+
* message: 'The phone number is not registered on WhatsApp',
|
|
114
|
+
* isInviteV4Sent: false
|
|
115
|
+
* }
|
|
116
|
+
* }
|
|
117
|
+
*
|
|
118
|
+
* For more usage examples:
|
|
119
|
+
* @see https://github.com/pedroslopez/whatsapp-web.js/pull/2344#usage-example1
|
|
120
|
+
*/
|
|
121
|
+
console.log(result);
|
|
122
|
+
} else if (msg.body === '!creategroup') {
|
|
123
|
+
const partitipantsToAdd = ['number1@c.us', 'number2@c.us', 'number3@c.us'];
|
|
124
|
+
const result = await client.createGroup('Group Title', partitipantsToAdd);
|
|
125
|
+
/**
|
|
126
|
+
* The example of the {@link result} output:
|
|
127
|
+
* {
|
|
128
|
+
* title: 'Group Title',
|
|
129
|
+
* gid: {
|
|
130
|
+
* server: 'g.us',
|
|
131
|
+
* user: '1111111111',
|
|
132
|
+
* _serialized: '1111111111@g.us'
|
|
133
|
+
* },
|
|
134
|
+
* participants: {
|
|
135
|
+
* 'botNumber@c.us': {
|
|
136
|
+
* statusCode: 200,
|
|
137
|
+
* message: 'The participant was added successfully',
|
|
138
|
+
* isGroupCreator: true,
|
|
139
|
+
* isInviteV4Sent: false
|
|
140
|
+
* },
|
|
141
|
+
* 'number1@c.us': {
|
|
142
|
+
* statusCode: 200,
|
|
143
|
+
* message: 'The participant was added successfully',
|
|
144
|
+
* isGroupCreator: false,
|
|
145
|
+
* isInviteV4Sent: false
|
|
146
|
+
* },
|
|
147
|
+
* 'number2@c.us': {
|
|
148
|
+
* statusCode: 403,
|
|
149
|
+
* message: 'The participant can be added by sending private invitation only',
|
|
150
|
+
* isGroupCreator: false,
|
|
151
|
+
* isInviteV4Sent: true
|
|
152
|
+
* },
|
|
153
|
+
* 'number3@c.us': {
|
|
154
|
+
* statusCode: 404,
|
|
155
|
+
* message: 'The phone number is not registered on WhatsApp',
|
|
156
|
+
* isGroupCreator: false,
|
|
157
|
+
* isInviteV4Sent: false
|
|
158
|
+
* }
|
|
159
|
+
* }
|
|
160
|
+
* }
|
|
161
|
+
*
|
|
162
|
+
* For more usage examples:
|
|
163
|
+
* @see https://github.com/pedroslopez/whatsapp-web.js/pull/2344#usage-example2
|
|
164
|
+
*/
|
|
165
|
+
console.log(result);
|
|
94
166
|
} else if (msg.body === '!groupinfo') {
|
|
95
167
|
let chat = await msg.getChat();
|
|
96
168
|
if (chat.isGroup) {
|
|
@@ -151,7 +223,14 @@ client.on('message', async msg => {
|
|
|
151
223
|
await client.sendMessage(msg.from, media, { isViewOnce: true });
|
|
152
224
|
}
|
|
153
225
|
} else if (msg.body === '!location') {
|
|
154
|
-
|
|
226
|
+
// only latitude and longitude
|
|
227
|
+
await msg.reply(new Location(37.422, -122.084));
|
|
228
|
+
// location with name only
|
|
229
|
+
await msg.reply(new Location(37.422, -122.084, { name: 'Googleplex' }));
|
|
230
|
+
// location with address only
|
|
231
|
+
await msg.reply(new Location(37.422, -122.084, { address: '1600 Amphitheatre Pkwy, Mountain View, CA 94043, USA' }));
|
|
232
|
+
// location with name, address and url
|
|
233
|
+
await msg.reply(new Location(37.422, -122.084, { name: 'Googleplex', address: '1600 Amphitheatre Pkwy, Mountain View, CA 94043, USA', url: 'https://google.com' }));
|
|
155
234
|
} else if (msg.location) {
|
|
156
235
|
msg.reply(msg.location);
|
|
157
236
|
} else if (msg.body.startsWith('!status ')) {
|
|
@@ -232,6 +311,52 @@ client.on('message', async msg => {
|
|
|
232
311
|
} else if (msg.body === '!removelabels') {
|
|
233
312
|
const chat = await msg.getChat();
|
|
234
313
|
await chat.changeLabels([]);
|
|
314
|
+
} else if (msg.body === '!approverequest') {
|
|
315
|
+
/**
|
|
316
|
+
* Presented an example for membership request approvals, the same examples are for the request rejections.
|
|
317
|
+
* To approve the membership request from a specific user:
|
|
318
|
+
*/
|
|
319
|
+
await client.approveGroupMembershipRequests(msg.from, { requesterIds: 'number@c.us' });
|
|
320
|
+
/** The same for execution on group object (no need to provide the group ID): */
|
|
321
|
+
const group = await msg.getChat();
|
|
322
|
+
await group.approveGroupMembershipRequests({ requesterIds: 'number@c.us' });
|
|
323
|
+
/** To approve several membership requests: */
|
|
324
|
+
const approval = await client.approveGroupMembershipRequests(msg.from, {
|
|
325
|
+
requesterIds: ['number1@c.us', 'number2@c.us']
|
|
326
|
+
});
|
|
327
|
+
/**
|
|
328
|
+
* The example of the {@link approval} output:
|
|
329
|
+
* [
|
|
330
|
+
* {
|
|
331
|
+
* requesterId: 'number1@c.us',
|
|
332
|
+
* message: 'Rejected successfully'
|
|
333
|
+
* },
|
|
334
|
+
* {
|
|
335
|
+
* requesterId: 'number2@c.us',
|
|
336
|
+
* error: 404,
|
|
337
|
+
* message: 'ParticipantRequestNotFoundError'
|
|
338
|
+
* }
|
|
339
|
+
* ]
|
|
340
|
+
*
|
|
341
|
+
*/
|
|
342
|
+
console.log(approval);
|
|
343
|
+
/** To approve all the existing membership requests (simply don't provide any user IDs): */
|
|
344
|
+
await client.approveGroupMembershipRequests(msg.from);
|
|
345
|
+
/** To change the sleep value to 300 ms: */
|
|
346
|
+
await client.approveGroupMembershipRequests(msg.from, {
|
|
347
|
+
requesterIds: ['number1@c.us', 'number2@c.us'],
|
|
348
|
+
sleep: 300
|
|
349
|
+
});
|
|
350
|
+
/** To change the sleep value to random value between 100 and 300 ms: */
|
|
351
|
+
await client.approveGroupMembershipRequests(msg.from, {
|
|
352
|
+
requesterIds: ['number1@c.us', 'number2@c.us'],
|
|
353
|
+
sleep: [100, 300]
|
|
354
|
+
});
|
|
355
|
+
/** To explicitly disable the sleep: */
|
|
356
|
+
await client.approveGroupMembershipRequests(msg.from, {
|
|
357
|
+
requesterIds: ['number1@c.us', 'number2@c.us'],
|
|
358
|
+
sleep: null
|
|
359
|
+
});
|
|
235
360
|
}
|
|
236
361
|
});
|
|
237
362
|
|
|
@@ -353,3 +478,29 @@ client.on('group_admin_changed', (notification) => {
|
|
|
353
478
|
/** Emitted when a current user is demoted to a regular user. */
|
|
354
479
|
console.log(`You were demoted by ${notification.author}`);
|
|
355
480
|
});
|
|
481
|
+
|
|
482
|
+
client.on('group_membership_request', async (notification) => {
|
|
483
|
+
/**
|
|
484
|
+
* The example of the {@link notification} output:
|
|
485
|
+
* {
|
|
486
|
+
* id: {
|
|
487
|
+
* fromMe: false,
|
|
488
|
+
* remote: 'groupId@g.us',
|
|
489
|
+
* id: '123123123132132132',
|
|
490
|
+
* participant: 'number@c.us',
|
|
491
|
+
* _serialized: 'false_groupId@g.us_123123123132132132_number@c.us'
|
|
492
|
+
* },
|
|
493
|
+
* body: '',
|
|
494
|
+
* type: 'created_membership_requests',
|
|
495
|
+
* timestamp: 1694456538,
|
|
496
|
+
* chatId: 'groupId@g.us',
|
|
497
|
+
* author: 'number@c.us',
|
|
498
|
+
* recipientIds: []
|
|
499
|
+
* }
|
|
500
|
+
*
|
|
501
|
+
*/
|
|
502
|
+
console.log(notification);
|
|
503
|
+
/** You can approve or reject the newly appeared membership request: */
|
|
504
|
+
await client.approveGroupMembershipRequestss(notification.chatId, notification.author);
|
|
505
|
+
await client.rejectGroupMembershipRequests(notification.chatId, notification.author);
|
|
506
|
+
});
|
package/index.d.ts
CHANGED
|
@@ -35,12 +35,8 @@ declare namespace WAWebJS {
|
|
|
35
35
|
/** Unpins the Chat and returns its new Pin state */
|
|
36
36
|
unpinChat(chatId: string): Promise<boolean>
|
|
37
37
|
|
|
38
|
-
/**
|
|
39
|
-
|
|
40
|
-
* @param name group title
|
|
41
|
-
* @param participants an array of Contacts or contact IDs to add to the group
|
|
42
|
-
*/
|
|
43
|
-
createGroup(name: string, participants: Contact[] | string[]): Promise<CreateGroupResult>
|
|
38
|
+
/** Creates a new group */
|
|
39
|
+
createGroup(title: string, participants?: string | Contact | Contact[] | string[], options?: CreateGroupOptions): Promise<CreateGroupResult|string>
|
|
44
40
|
|
|
45
41
|
/** Closes the client */
|
|
46
42
|
destroy(): Promise<void>
|
|
@@ -160,6 +156,15 @@ declare namespace WAWebJS {
|
|
|
160
156
|
/** Deletes the current user's profile picture */
|
|
161
157
|
deleteProfilePicture(): Promise<boolean>
|
|
162
158
|
|
|
159
|
+
/** Gets an array of membership requests */
|
|
160
|
+
getGroupMembershipRequests: (groupId: string) => Promise<Array<GroupMembershipRequest>>
|
|
161
|
+
|
|
162
|
+
/** Approves membership requests if any */
|
|
163
|
+
approveGroupMembershipRequests: (groupId: string, options: MembershipRequestActionOptions) => Promise<Array<MembershipRequestActionResult>>;
|
|
164
|
+
|
|
165
|
+
/** Rejects membership requests if any */
|
|
166
|
+
rejectGroupMembershipRequests: (groupId: string, options: MembershipRequestActionOptions) => Promise<Array<MembershipRequestActionResult>>;
|
|
167
|
+
|
|
163
168
|
/** Generic event */
|
|
164
169
|
on(event: string, listener: (...args: any) => void): this
|
|
165
170
|
|
|
@@ -210,6 +215,15 @@ declare namespace WAWebJS {
|
|
|
210
215
|
notification: GroupNotification
|
|
211
216
|
) => void): this
|
|
212
217
|
|
|
218
|
+
/**
|
|
219
|
+
* Emitted when some user requested to join the group
|
|
220
|
+
* that has the membership approval mode turned on
|
|
221
|
+
*/
|
|
222
|
+
on(event: 'group_membership_request', listener: (
|
|
223
|
+
/** GroupNotification with more information about the action */
|
|
224
|
+
notification: GroupNotification
|
|
225
|
+
) => void): this
|
|
226
|
+
|
|
213
227
|
/** Emitted when group settings are updated, such as subject, description or picture */
|
|
214
228
|
on(event: 'group_update', listener: (
|
|
215
229
|
/** GroupNotification with more information about the action */
|
|
@@ -522,14 +536,47 @@ declare namespace WAWebJS {
|
|
|
522
536
|
plugged: boolean,
|
|
523
537
|
}
|
|
524
538
|
|
|
539
|
+
/** An object that handles options for group creation */
|
|
540
|
+
export interface CreateGroupOptions {
|
|
541
|
+
/**
|
|
542
|
+
* The number of seconds for the messages to disappear in the group,
|
|
543
|
+
* won't take an effect if the group is been creating with myself only
|
|
544
|
+
* @default 0
|
|
545
|
+
*/
|
|
546
|
+
messageTimer?: number
|
|
547
|
+
/**
|
|
548
|
+
* The ID of a parent community group to link the newly created group with,
|
|
549
|
+
* won't take an effect if the group is been creating with myself only
|
|
550
|
+
*/
|
|
551
|
+
parentGroupId?: string
|
|
552
|
+
/** If true, the inviteV4 will be sent to those participants
|
|
553
|
+
* who have restricted others from being automatically added to groups,
|
|
554
|
+
* otherwise the inviteV4 won't be sent
|
|
555
|
+
* @default true
|
|
556
|
+
*/
|
|
557
|
+
autoSendInviteV4?: boolean,
|
|
558
|
+
/**
|
|
559
|
+
* The comment to be added to an inviteV4 (empty string by default)
|
|
560
|
+
* @default ''
|
|
561
|
+
*/
|
|
562
|
+
comment?: string
|
|
563
|
+
}
|
|
564
|
+
|
|
565
|
+
/** An object that handles the result for createGroup method */
|
|
525
566
|
export interface CreateGroupResult {
|
|
526
|
-
/**
|
|
527
|
-
|
|
528
|
-
/**
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
567
|
+
/** A group title */
|
|
568
|
+
title: string;
|
|
569
|
+
/** An object that handles the newly created group ID */
|
|
570
|
+
gid: ChatId;
|
|
571
|
+
/** An object that handles the result value for each added to the group participant */
|
|
572
|
+
participants: {
|
|
573
|
+
[participantId: string]: {
|
|
574
|
+
statusCode: number,
|
|
575
|
+
message: string,
|
|
576
|
+
isGroupCreator: boolean,
|
|
577
|
+
isInviteV4Sent: boolean
|
|
578
|
+
};
|
|
579
|
+
};
|
|
533
580
|
}
|
|
534
581
|
|
|
535
582
|
export interface GroupNotification {
|
|
@@ -589,6 +636,7 @@ declare namespace WAWebJS {
|
|
|
589
636
|
GROUP_JOIN = 'group_join',
|
|
590
637
|
GROUP_LEAVE = 'group_leave',
|
|
591
638
|
GROUP_ADMIN_CHANGED = 'group_admin_changed',
|
|
639
|
+
GROUP_MEMBERSHIP_REQUEST = 'group_membership_request',
|
|
592
640
|
GROUP_UPDATE = 'group_update',
|
|
593
641
|
QR_RECEIVED = 'qr',
|
|
594
642
|
LOADING_SCREEN = 'loading_screen',
|
|
@@ -879,13 +927,23 @@ declare namespace WAWebJS {
|
|
|
879
927
|
_serialized: string,
|
|
880
928
|
}
|
|
881
929
|
|
|
930
|
+
/** Options for sending a location */
|
|
931
|
+
export interface LocationSendOptions {
|
|
932
|
+
/** Location name */
|
|
933
|
+
name?: string;
|
|
934
|
+
/** Location address */
|
|
935
|
+
address?: string;
|
|
936
|
+
/** URL address to be shown within a location message */
|
|
937
|
+
url?: string;
|
|
938
|
+
}
|
|
939
|
+
|
|
882
940
|
/** Location information */
|
|
883
941
|
export class Location {
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
942
|
+
latitude: string;
|
|
943
|
+
longitude: string;
|
|
944
|
+
options?: LocationSendOptions;
|
|
887
945
|
|
|
888
|
-
constructor(latitude: number, longitude: number,
|
|
946
|
+
constructor(latitude: number, longitude: number, options?: LocationSendOptions)
|
|
889
947
|
}
|
|
890
948
|
|
|
891
949
|
export interface Label {
|
|
@@ -1167,9 +1225,9 @@ declare namespace WAWebJS {
|
|
|
1167
1225
|
/** Returns the Contact that corresponds to this Chat. */
|
|
1168
1226
|
getContact: () => Promise<Contact>,
|
|
1169
1227
|
/** Marks this Chat as unread */
|
|
1170
|
-
markUnread: () => Promise<void
|
|
1228
|
+
markUnread: () => Promise<void>,
|
|
1171
1229
|
/** Returns array of all Labels assigned to this Chat */
|
|
1172
|
-
getLabels: () => Promise<Label[]
|
|
1230
|
+
getLabels: () => Promise<Label[]>,
|
|
1173
1231
|
/** Add or remove labels to this Chat */
|
|
1174
1232
|
changeLabels: (labelIds: Array<string | number>) => Promise<void>
|
|
1175
1233
|
}
|
|
@@ -1229,18 +1287,70 @@ declare namespace WAWebJS {
|
|
|
1229
1287
|
export type ChangeParticipantsPermissions =
|
|
1230
1288
|
(participantIds: Array<string>) => Promise<{ status: number }>
|
|
1231
1289
|
|
|
1232
|
-
/**
|
|
1233
|
-
export
|
|
1234
|
-
|
|
1235
|
-
|
|
1236
|
-
|
|
1237
|
-
|
|
1238
|
-
|
|
1239
|
-
|
|
1240
|
-
|
|
1241
|
-
|
|
1242
|
-
|
|
1243
|
-
|
|
1290
|
+
/** An object that handles the result for addParticipants method */
|
|
1291
|
+
export interface AddParticipantsResult {
|
|
1292
|
+
[participantId: string]: {
|
|
1293
|
+
code: number;
|
|
1294
|
+
message: string;
|
|
1295
|
+
isInviteV4Sent: boolean,
|
|
1296
|
+
};
|
|
1297
|
+
};
|
|
1298
|
+
|
|
1299
|
+
/** An object that handles options for adding participants */
|
|
1300
|
+
export interface AddParticipantsOptions {
|
|
1301
|
+
/**
|
|
1302
|
+
* The number of milliseconds to wait before adding the next participant.
|
|
1303
|
+
* If it is an array, a random sleep time between the sleep[0] and sleep[1] values will be added
|
|
1304
|
+
* (the difference must be >=100 ms, otherwise, a random sleep time between sleep[1] and sleep[1] + 100
|
|
1305
|
+
* will be added). If sleep is a number, a sleep time equal to its value will be added
|
|
1306
|
+
* @default [250,500]
|
|
1307
|
+
*/
|
|
1308
|
+
sleep?: Array<number>|number,
|
|
1309
|
+
/**
|
|
1310
|
+
* If true, the inviteV4 will be sent to those participants
|
|
1311
|
+
* who have restricted others from being automatically added to groups,
|
|
1312
|
+
* otherwise the inviteV4 won't be sent
|
|
1313
|
+
* @default true
|
|
1314
|
+
*/
|
|
1315
|
+
autoSendInviteV4?: boolean,
|
|
1316
|
+
/**
|
|
1317
|
+
* The comment to be added to an inviteV4 (empty string by default)
|
|
1318
|
+
* @default ''
|
|
1319
|
+
*/
|
|
1320
|
+
comment?: string
|
|
1321
|
+
};
|
|
1322
|
+
|
|
1323
|
+
/** An object that handles the information about the group membership request */
|
|
1324
|
+
export interface GroupMembershipRequest {
|
|
1325
|
+
/** The wid of a user who requests to enter the group */
|
|
1326
|
+
id: Object;
|
|
1327
|
+
/** The wid of a user who created that request */
|
|
1328
|
+
addedBy: Object;
|
|
1329
|
+
/** The wid of a community parent group to which the current group is linked */
|
|
1330
|
+
parentGroupId: Object | null;
|
|
1331
|
+
/** The method used to create the request: NonAdminAdd/InviteLink/LinkedGroupJoin */
|
|
1332
|
+
requestMethod: string,
|
|
1333
|
+
/** The timestamp the request was created at */
|
|
1334
|
+
t: number
|
|
1335
|
+
}
|
|
1336
|
+
|
|
1337
|
+
/** An object that handles the result for membership request action */
|
|
1338
|
+
export interface MembershipRequestActionResult {
|
|
1339
|
+
/** User ID whos membership request was approved/rejected */
|
|
1340
|
+
requesterId: Array<string> | string | null;
|
|
1341
|
+
/** An error code that occurred during the operation for the participant */
|
|
1342
|
+
error?: number;
|
|
1343
|
+
/** A message with a result of membership request action */
|
|
1344
|
+
message: string;
|
|
1345
|
+
}
|
|
1346
|
+
|
|
1347
|
+
/** Options for performing a membership request action */
|
|
1348
|
+
export interface MembershipRequestActionOptions {
|
|
1349
|
+
/** User ID/s who requested to join the group, if no value is provided, the method will search for all membership requests for that group */
|
|
1350
|
+
requesterIds: Array<string> | string | null;
|
|
1351
|
+
/** The number of milliseconds to wait before performing an operation for the next requester. If it is an array, a random sleep time between the sleep[0] and sleep[1] values will be added (the difference must be >=100 ms, otherwise, a random sleep time between sleep[1] and sleep[1] + 100 will be added). If sleep is a number, a sleep time equal to its value will be added. By default, sleep is an array with a value of [250, 500] */
|
|
1352
|
+
sleep: Array<number> | number | null;
|
|
1353
|
+
}
|
|
1244
1354
|
|
|
1245
1355
|
export interface GroupChat extends Chat {
|
|
1246
1356
|
/** Group owner */
|
|
@@ -1252,9 +1362,9 @@ declare namespace WAWebJS {
|
|
|
1252
1362
|
/** Group participants */
|
|
1253
1363
|
participants: Array<GroupParticipant>;
|
|
1254
1364
|
/** Adds a list of participants by ID to the group */
|
|
1255
|
-
addParticipants:
|
|
1365
|
+
addParticipants: (participantIds: string|string[], options?: AddParticipantsOptions) => Promise<Object.<string, AddParticipantsResult>|string>;
|
|
1256
1366
|
/** Removes a list of participants by ID to the group */
|
|
1257
|
-
removeParticipants:
|
|
1367
|
+
removeParticipants: (participantIds: string[]) => Promise<{ status: number }>;
|
|
1258
1368
|
/** Promotes participants by IDs to admins */
|
|
1259
1369
|
promoteParticipants: ChangeParticipantsPermissions;
|
|
1260
1370
|
/** Demotes participants by IDs to regular users */
|
|
@@ -1263,17 +1373,34 @@ declare namespace WAWebJS {
|
|
|
1263
1373
|
setSubject: (subject: string) => Promise<boolean>;
|
|
1264
1374
|
/** Updates the group description */
|
|
1265
1375
|
setDescription: (description: string) => Promise<boolean>;
|
|
1266
|
-
/** Updates the group settings to only allow admins to send messages
|
|
1267
|
-
* @param {boolean} [adminsOnly=true] Enable or disable this option
|
|
1376
|
+
/** Updates the group settings to only allow admins to send messages
|
|
1377
|
+
* @param {boolean} [adminsOnly=true] Enable or disable this option
|
|
1268
1378
|
* @returns {Promise<boolean>} Returns true if the setting was properly updated. This can return false if the user does not have the necessary permissions.
|
|
1269
1379
|
*/
|
|
1270
1380
|
setMessagesAdminsOnly: (adminsOnly?: boolean) => Promise<boolean>;
|
|
1271
1381
|
/**
|
|
1272
1382
|
* Updates the group settings to only allow admins to edit group info (title, description, photo).
|
|
1273
|
-
* @param {boolean} [adminsOnly=true] Enable or disable this option
|
|
1383
|
+
* @param {boolean} [adminsOnly=true] Enable or disable this option
|
|
1274
1384
|
* @returns {Promise<boolean>} Returns true if the setting was properly updated. This can return false if the user does not have the necessary permissions.
|
|
1275
1385
|
*/
|
|
1276
1386
|
setInfoAdminsOnly: (adminsOnly?: boolean) => Promise<boolean>;
|
|
1387
|
+
/**
|
|
1388
|
+
* Gets an array of membership requests
|
|
1389
|
+
* @returns {Promise<Array<GroupMembershipRequest>>} An array of membership requests
|
|
1390
|
+
*/
|
|
1391
|
+
getGroupMembershipRequests: () => Promise<Array<GroupMembershipRequest>>;
|
|
1392
|
+
/**
|
|
1393
|
+
* Approves membership requests if any
|
|
1394
|
+
* @param {MembershipRequestActionOptions} options Options for performing a membership request action
|
|
1395
|
+
* @returns {Promise<Array<MembershipRequestActionResult>>} Returns an array of requester IDs whose membership requests were approved and an error for each requester, if any occurred during the operation. If there are no requests, an empty array will be returned
|
|
1396
|
+
*/
|
|
1397
|
+
approveGroupMembershipRequests: (options: MembershipRequestActionOptions) => Promise<Array<MembershipRequestActionResult>>;
|
|
1398
|
+
/**
|
|
1399
|
+
* Rejects membership requests if any
|
|
1400
|
+
* @param {MembershipRequestActionOptions} options Options for performing a membership request action
|
|
1401
|
+
* @returns {Promise<Array<MembershipRequestActionResult>>} Returns an array of requester IDs whose membership requests were rejected and an error for each requester, if any occurred during the operation. If there are no requests, an empty array will be returned
|
|
1402
|
+
*/
|
|
1403
|
+
rejectGroupMembershipRequests: (options: MembershipRequestActionOptions) => Promise<Array<MembershipRequestActionResult>>;
|
|
1277
1404
|
/** Gets the invite code for a specific group */
|
|
1278
1405
|
getInviteCode: () => Promise<string>;
|
|
1279
1406
|
/** Invalidates the current group invite code and generates a new one */
|