zaileys 1.1.40-tx.9 → 2.0.0
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/README.MD +286 -9
- package/dist/index.d.mts +90 -6
- package/dist/index.d.ts +90 -6
- package/dist/index.js +15 -15
- package/dist/index.mjs +15 -15
- package/package.json +63 -63
package/README.MD
CHANGED
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
|
|
17
17
|
<div align="center">
|
|
18
18
|
<p>
|
|
19
|
-
<b>Zaileys</b> is a powerful, type-safe wrapper around Baileys
|
|
19
|
+
<b>Zaileys</b> is a powerful, type-safe wrapper around <a href="https://github.com/WhiskeySockets/Baileys">Baileys</a>, designed to simplify the development of WhatsApp bots. It provides a robust architecture with built-in state management, middleware support, and easy-to-use event handlers, making it perfect for building scalable and maintainable WhatsApp applications.
|
|
20
20
|
</p>
|
|
21
21
|
</div>
|
|
22
22
|
|
|
@@ -28,9 +28,12 @@
|
|
|
28
28
|
[🪶 Features](#-features) •
|
|
29
29
|
[📦 Installation](#-installation) •
|
|
30
30
|
[⚡ Quick Start](#-quick-start) •
|
|
31
|
+
[🧩 Plugins](#-plugins) •
|
|
31
32
|
[📨 Sending Messages](#-sending-messages) •
|
|
32
33
|
[👥 Group Management](#-group-management) •
|
|
33
|
-
[
|
|
34
|
+
[📰 Newsletter Management](#-newsletter-channel) •
|
|
35
|
+
[🌐 Community Management](#-community-management) •
|
|
36
|
+
[🔒 Privacy](#-privacy-settings) •
|
|
34
37
|
[🤝 Contributing](#-contributing)
|
|
35
38
|
|
|
36
39
|
</div>
|
|
@@ -92,6 +95,8 @@ Here is a minimal example to get your bot running with QR code authentication:
|
|
|
92
95
|
|
|
93
96
|
```typescript
|
|
94
97
|
import { Client } from 'zaileys';
|
|
98
|
+
// or
|
|
99
|
+
const { Client } = require('zaileys');
|
|
95
100
|
|
|
96
101
|
const wa = new Client({
|
|
97
102
|
authType: 'qr',
|
|
@@ -548,7 +553,7 @@ Create a new group with initial participants.
|
|
|
548
553
|
|
|
549
554
|
```typescript
|
|
550
555
|
// Create group with name and participants
|
|
551
|
-
const group = await wa.group.create('My Group', [
|
|
556
|
+
const group = await wa.group.create('My Group', ['senderId']);
|
|
552
557
|
console.log('Group created:', group);
|
|
553
558
|
```
|
|
554
559
|
|
|
@@ -560,16 +565,16 @@ Add, remove, promote, or demote participants.
|
|
|
560
565
|
const groupId = '1234567890@g.us';
|
|
561
566
|
|
|
562
567
|
// Add participants
|
|
563
|
-
await wa.group.participant(groupId, [
|
|
568
|
+
await wa.group.participant(groupId, ['senderId'], 'add');
|
|
564
569
|
|
|
565
570
|
// Remove participants
|
|
566
|
-
await wa.group.participant(groupId, [
|
|
571
|
+
await wa.group.participant(groupId, [...], 'remove');
|
|
567
572
|
|
|
568
573
|
// Promote to admin
|
|
569
|
-
await wa.group.participant(groupId, [
|
|
574
|
+
await wa.group.participant(groupId, [...], 'promote');
|
|
570
575
|
|
|
571
576
|
// Demote to member
|
|
572
|
-
await wa.group.participant(groupId, [
|
|
577
|
+
await wa.group.participant(groupId, [...], 'demote');
|
|
573
578
|
```
|
|
574
579
|
|
|
575
580
|
### Group Profile
|
|
@@ -648,10 +653,10 @@ Manage pending join requests.
|
|
|
648
653
|
const requests = await wa.group.requestJoinList(groupId);
|
|
649
654
|
|
|
650
655
|
// Approve requests
|
|
651
|
-
await wa.group.requestJoin(groupId, [
|
|
656
|
+
await wa.group.requestJoin(groupId, ['senderId'], 'approve');
|
|
652
657
|
|
|
653
658
|
// Reject requests
|
|
654
|
-
await wa.group.requestJoin(groupId, [
|
|
659
|
+
await wa.group.requestJoin(groupId, [...], 'reject');
|
|
655
660
|
```
|
|
656
661
|
|
|
657
662
|
### Fetch All Groups
|
|
@@ -689,6 +694,278 @@ Leave group.
|
|
|
689
694
|
await wa.group.leave(groupId);
|
|
690
695
|
```
|
|
691
696
|
|
|
697
|
+
## 📰 Newsletter (Channel)
|
|
698
|
+
|
|
699
|
+
Create and manage WhatsApp Channels (Newsletters).
|
|
700
|
+
|
|
701
|
+
> **Quick Jump:** [Create](#create-channel) · [Actions](#channel-actions) · [Update](#update-channel) · [Info](#channel-info) · [Messages](#manage-messages) · [Admin](#admin-actions)
|
|
702
|
+
|
|
703
|
+
### Create Channel
|
|
704
|
+
|
|
705
|
+
```typescript
|
|
706
|
+
const channel = await wa.newsletter.create('My Channel', 'Description here');
|
|
707
|
+
console.log('Channel created:', channel);
|
|
708
|
+
```
|
|
709
|
+
|
|
710
|
+
### Channel Actions
|
|
711
|
+
|
|
712
|
+
Follow, unfollow, mute, or unmute a channel.
|
|
713
|
+
|
|
714
|
+
```typescript
|
|
715
|
+
const channelId = '1234567890@newsletter';
|
|
716
|
+
|
|
717
|
+
// Follow
|
|
718
|
+
await wa.newsletter.action(channelId, 'follow');
|
|
719
|
+
|
|
720
|
+
// Unfollow
|
|
721
|
+
await wa.newsletter.action(channelId, 'unfollow');
|
|
722
|
+
|
|
723
|
+
// Mute
|
|
724
|
+
await wa.newsletter.action(channelId, 'mute');
|
|
725
|
+
|
|
726
|
+
// Unmute
|
|
727
|
+
await wa.newsletter.action(channelId, 'unmute');
|
|
728
|
+
```
|
|
729
|
+
|
|
730
|
+
### Update Channel
|
|
731
|
+
|
|
732
|
+
Update channel info.
|
|
733
|
+
|
|
734
|
+
```typescript
|
|
735
|
+
// Update name
|
|
736
|
+
await wa.newsletter.update(channelId, 'New Name', 'name');
|
|
737
|
+
|
|
738
|
+
// Update description
|
|
739
|
+
await wa.newsletter.update(channelId, 'New Description', 'description');
|
|
740
|
+
|
|
741
|
+
// Update picture (URL/Buffer)
|
|
742
|
+
await wa.newsletter.update(channelId, 'https://example.com/image.jpg', 'picture');
|
|
743
|
+
|
|
744
|
+
// Remove picture
|
|
745
|
+
await wa.newsletter.removePicture(channelId);
|
|
746
|
+
```
|
|
747
|
+
|
|
748
|
+
### Channel Info
|
|
749
|
+
|
|
750
|
+
Get channel details.
|
|
751
|
+
|
|
752
|
+
```typescript
|
|
753
|
+
// Get metadata by ChannelId
|
|
754
|
+
const meta = await wa.newsletter.metadata(channelId, 'jid');
|
|
755
|
+
|
|
756
|
+
// Get metadata by Invite Code
|
|
757
|
+
const metaInvite = await wa.newsletter.metadata('INVITE_CODE', 'invite');
|
|
758
|
+
|
|
759
|
+
// Get subscribers
|
|
760
|
+
const subs = await wa.newsletter.subscribers(channelId);
|
|
761
|
+
|
|
762
|
+
// Get admin count
|
|
763
|
+
const adminCount = await wa.newsletter.adminCount(channelId);
|
|
764
|
+
```
|
|
765
|
+
|
|
766
|
+
### Manage Messages
|
|
767
|
+
|
|
768
|
+
Fetch messages or react to them.
|
|
769
|
+
|
|
770
|
+
```typescript
|
|
771
|
+
// Fetch messages
|
|
772
|
+
const since = new Date() - 1000 * 60 * 60 * 24; // 1 day
|
|
773
|
+
const after = new Date();
|
|
774
|
+
|
|
775
|
+
const count = 10;
|
|
776
|
+
|
|
777
|
+
const messages = await wa.newsletter.fetchMessages(channelId, count, since, after);
|
|
778
|
+
|
|
779
|
+
// React to message
|
|
780
|
+
await wa.newsletter.reaction(channelId, 'chatId', '👍');
|
|
781
|
+
```
|
|
782
|
+
|
|
783
|
+
### Admin Actions
|
|
784
|
+
|
|
785
|
+
Manage channel ownership and admins.
|
|
786
|
+
|
|
787
|
+
```typescript
|
|
788
|
+
// Change owner
|
|
789
|
+
await wa.newsletter.changeOwner(channelId, 'senderId');
|
|
790
|
+
|
|
791
|
+
// Demote admin
|
|
792
|
+
await wa.newsletter.demote(channelId, 'senderId');
|
|
793
|
+
|
|
794
|
+
// Delete channel
|
|
795
|
+
await wa.newsletter.delete(channelId);
|
|
796
|
+
```
|
|
797
|
+
|
|
798
|
+
## 🌐 Community Management
|
|
799
|
+
|
|
800
|
+
Create and manage WhatsApp Communities.
|
|
801
|
+
|
|
802
|
+
> **Quick Jump:** [Create](#create-community) · [Create Group](#create-group-in-community) · [Groups](#manage-groups) · [Info](#community-info) · [Participants](#manage-participants-1) · [Invite](#invite-code-1) · [Settings](#community-settings) · [Leave](#leave-community)
|
|
803
|
+
|
|
804
|
+
### Create Community
|
|
805
|
+
|
|
806
|
+
```typescript
|
|
807
|
+
const community = await wa.community.create('My Community', 'Description here');
|
|
808
|
+
console.log('Community created:', community);
|
|
809
|
+
```
|
|
810
|
+
|
|
811
|
+
### Create Group in Community
|
|
812
|
+
|
|
813
|
+
Create a new group linked to a community.
|
|
814
|
+
|
|
815
|
+
```typescript
|
|
816
|
+
const communityId = '1234567890@g.us';
|
|
817
|
+
const group = await wa.community.createGroup('New Group', ['senderId'], communityId);
|
|
818
|
+
```
|
|
819
|
+
|
|
820
|
+
### Manage Groups
|
|
821
|
+
|
|
822
|
+
Link or unlink groups from a community.
|
|
823
|
+
|
|
824
|
+
```typescript
|
|
825
|
+
const groupId = '0987654321@g.us';
|
|
826
|
+
|
|
827
|
+
// Link group
|
|
828
|
+
await wa.community.group(communityId, 'link', groupId);
|
|
829
|
+
|
|
830
|
+
// Unlink group
|
|
831
|
+
await wa.community.group(communityId, 'unlink', groupId);
|
|
832
|
+
|
|
833
|
+
// Get linked groups
|
|
834
|
+
const linkedGroups = await wa.community.group(communityId, 'linked');
|
|
835
|
+
```
|
|
836
|
+
|
|
837
|
+
### Community Info
|
|
838
|
+
|
|
839
|
+
Get metadata or update info.
|
|
840
|
+
|
|
841
|
+
```typescript
|
|
842
|
+
// Get metadata
|
|
843
|
+
const meta = await wa.community.metadata(communityId);
|
|
844
|
+
|
|
845
|
+
// Update subject
|
|
846
|
+
await wa.community.update(communityId, 'subject', 'New Name');
|
|
847
|
+
|
|
848
|
+
// Update description
|
|
849
|
+
await wa.community.update(communityId, 'description', 'New Description');
|
|
850
|
+
```
|
|
851
|
+
|
|
852
|
+
### Manage Participants
|
|
853
|
+
|
|
854
|
+
Manage community participants.
|
|
855
|
+
|
|
856
|
+
```typescript
|
|
857
|
+
// List participants
|
|
858
|
+
const participants = await wa.community.participants(communityId, 'list');
|
|
859
|
+
|
|
860
|
+
// Add participant
|
|
861
|
+
await wa.community.participants(communityId, 'update', 'add', ['senderId']);
|
|
862
|
+
|
|
863
|
+
// Remove participant
|
|
864
|
+
await wa.community.participants(communityId, 'update', 'remove', ['senderId']);
|
|
865
|
+
|
|
866
|
+
// Promote to admin
|
|
867
|
+
await wa.community.participants(communityId, 'update', 'promote', ['senderId']);
|
|
868
|
+
|
|
869
|
+
// Demote to member
|
|
870
|
+
await wa.community.participants(communityId, 'update', 'demote', ['senderId']);
|
|
871
|
+
```
|
|
872
|
+
|
|
873
|
+
### Invite Code
|
|
874
|
+
|
|
875
|
+
Manage community invite links.
|
|
876
|
+
|
|
877
|
+
```typescript
|
|
878
|
+
// Get invite code
|
|
879
|
+
const code = await wa.community.invite(communityId, 'code');
|
|
880
|
+
|
|
881
|
+
// Revoke invite code
|
|
882
|
+
await wa.community.invite(communityId, 'revoke');
|
|
883
|
+
|
|
884
|
+
// Get invite info
|
|
885
|
+
const info = await wa.community.invite('INVITE_CODE', 'info');
|
|
886
|
+
|
|
887
|
+
// Join via invite code
|
|
888
|
+
await wa.community.invite('INVITE_CODE', 'accept');
|
|
889
|
+
```
|
|
890
|
+
|
|
891
|
+
### Community Settings
|
|
892
|
+
|
|
893
|
+
Configure community settings.
|
|
894
|
+
|
|
895
|
+
```typescript
|
|
896
|
+
// Toggle ephemeral messages
|
|
897
|
+
await wa.community.settings(communityId, 'ephemeral', 86400); // 24 hours
|
|
898
|
+
|
|
899
|
+
// Who can add members? 'all_member_add' or 'admin_add'
|
|
900
|
+
await wa.community.settings(communityId, 'memberAdd', 'admin_add');
|
|
901
|
+
|
|
902
|
+
// Join approval mode? 'on' or 'off'
|
|
903
|
+
await wa.community.settings(communityId, 'approval', 'on');
|
|
904
|
+
```
|
|
905
|
+
|
|
906
|
+
### Leave Community
|
|
907
|
+
|
|
908
|
+
Leave a community.
|
|
909
|
+
|
|
910
|
+
```typescript
|
|
911
|
+
await wa.community.leave(communityId);
|
|
912
|
+
```
|
|
913
|
+
|
|
914
|
+
## 🔒 Privacy Settings
|
|
915
|
+
|
|
916
|
+
Manage your privacy settings and block list.
|
|
917
|
+
|
|
918
|
+
> **Quick Jump:** [Block/Unblock](#blockunblock) · [Configuration](#privacy-configuration) · [Get Settings](#get-settings)
|
|
919
|
+
|
|
920
|
+
### Block/Unblock
|
|
921
|
+
|
|
922
|
+
```typescript
|
|
923
|
+
// Block user
|
|
924
|
+
await wa.privacy.block('senderId');
|
|
925
|
+
|
|
926
|
+
// Unblock user
|
|
927
|
+
await wa.privacy.unblock('senderId');
|
|
928
|
+
|
|
929
|
+
// Get blocklist
|
|
930
|
+
const blocklist = await wa.privacy.blocklist();
|
|
931
|
+
```
|
|
932
|
+
|
|
933
|
+
### Privacy Configuration
|
|
934
|
+
|
|
935
|
+
Update privacy settings.
|
|
936
|
+
|
|
937
|
+
```typescript
|
|
938
|
+
// Last Seen: 'all', 'contacts', 'contact_blacklist', 'none'
|
|
939
|
+
await wa.privacy.lastSeen('contacts');
|
|
940
|
+
|
|
941
|
+
// Online: 'all', 'match_last_seen'
|
|
942
|
+
await wa.privacy.online('match_last_seen');
|
|
943
|
+
|
|
944
|
+
// Profile Picture: 'all', 'contacts', 'contact_blacklist', 'none'
|
|
945
|
+
await wa.privacy.picture('all');
|
|
946
|
+
|
|
947
|
+
// Status: 'all', 'contacts', 'contact_blacklist', 'none'
|
|
948
|
+
await wa.privacy.status('contacts');
|
|
949
|
+
|
|
950
|
+
// Read Receipts: 'all', 'none'
|
|
951
|
+
await wa.privacy.readReceipt('all');
|
|
952
|
+
|
|
953
|
+
// Group Add: 'all', 'contacts', 'contact_blacklist', 'none'
|
|
954
|
+
await wa.privacy.groupsAdd('contacts');
|
|
955
|
+
|
|
956
|
+
// Default Disappearing Mode: 'off', '24h', '7d', '90d'
|
|
957
|
+
await wa.privacy.ephemeral('90d');
|
|
958
|
+
```
|
|
959
|
+
|
|
960
|
+
### Get Settings
|
|
961
|
+
|
|
962
|
+
Fetch current privacy settings.
|
|
963
|
+
|
|
964
|
+
```typescript
|
|
965
|
+
const settings = await wa.privacy.getSettings();
|
|
966
|
+
console.log(settings);
|
|
967
|
+
```
|
|
968
|
+
|
|
692
969
|
## 🤝 Contributing
|
|
693
970
|
|
|
694
971
|
Contributions are welcome! Please follow these steps:
|
package/dist/index.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as baileys from 'baileys';
|
|
2
|
-
import { AuthenticationState, WAMessage, proto, ParticipantAction } from 'baileys';
|
|
2
|
+
import { AuthenticationState, WAMessage, proto, ParticipantAction, WAPrivacyValue, WAPrivacyOnlineValue, WAReadReceiptsValue, WAPrivacyGroupAddValue } from 'baileys';
|
|
3
3
|
import z, { z as z$1 } from 'zod';
|
|
4
4
|
import _ from 'lodash';
|
|
5
5
|
|
|
@@ -94,6 +94,7 @@ declare const ButtonOptionsType: z.ZodIntersection<z.ZodObject<{
|
|
|
94
94
|
text: z.ZodString;
|
|
95
95
|
section: z.ZodArray<z.ZodObject<{
|
|
96
96
|
title: z.ZodString;
|
|
97
|
+
highlight_label: z.ZodOptional<z.ZodString>;
|
|
97
98
|
rows: z.ZodArray<z.ZodObject<{
|
|
98
99
|
id: z.ZodString;
|
|
99
100
|
title: z.ZodString;
|
|
@@ -129,18 +130,18 @@ declare class Signal {
|
|
|
129
130
|
declare class Group {
|
|
130
131
|
protected client: Client;
|
|
131
132
|
constructor(client: Client);
|
|
132
|
-
create(name: string, participants:
|
|
133
|
-
participant(roomId: string, participants:
|
|
133
|
+
create(name: string, participants: string[]): Promise<baileys.GroupMetadata>;
|
|
134
|
+
participant(roomId: string, participants: string[], action: ParticipantAction): Promise<{
|
|
134
135
|
status: string;
|
|
135
136
|
jid: string | undefined;
|
|
136
137
|
content: baileys.BinaryNode;
|
|
137
138
|
}[]>;
|
|
138
|
-
profile(roomId: string, update: string | Buffer, type: 'subject' | 'description' | '
|
|
139
|
+
profile(roomId: string, update: string | Buffer, type: 'subject' | 'description' | 'picture'): Promise<void>;
|
|
139
140
|
setting(roomId: string, type: 'open' | 'close' | 'locked' | 'unlocked' | 'all_member_add' | 'admin_add'): Promise<void>;
|
|
140
141
|
leave(roomId: string): Promise<void>;
|
|
141
142
|
inviteCode(roomId: string, type: 'code' | 'revoke' | 'accept' | 'info'): Promise<string | baileys.GroupMetadata>;
|
|
142
143
|
metadata(roomId: string): Promise<baileys.GroupMetadata>;
|
|
143
|
-
requestJoin(roomId: string, participants:
|
|
144
|
+
requestJoin(roomId: string, participants: string[], type: 'approve' | 'reject'): Promise<{
|
|
144
145
|
status: string;
|
|
145
146
|
jid: string | undefined;
|
|
146
147
|
}[]>;
|
|
@@ -441,7 +442,90 @@ declare class Plugins {
|
|
|
441
442
|
}
|
|
442
443
|
declare const definePlugins: (handler: PluginsHandlerType, config: PluginsConfigType) => PluginDefinition;
|
|
443
444
|
|
|
444
|
-
|
|
445
|
+
declare class Privacy {
|
|
446
|
+
protected client: Client;
|
|
447
|
+
constructor(client: Client);
|
|
448
|
+
block(senderId: string): Promise<void>;
|
|
449
|
+
unblock(senderId: string): Promise<void>;
|
|
450
|
+
lastSeen(type: WAPrivacyValue): Promise<void>;
|
|
451
|
+
online(type: WAPrivacyOnlineValue): Promise<void>;
|
|
452
|
+
picture(type: WAPrivacyValue): Promise<void>;
|
|
453
|
+
status(type: WAPrivacyValue): Promise<void>;
|
|
454
|
+
readReceipt(type: WAReadReceiptsValue): Promise<void>;
|
|
455
|
+
groupsAdd(type: WAPrivacyGroupAddValue): Promise<void>;
|
|
456
|
+
ephemeral(type: 'off' | '24h' | '7d' | '90d'): Promise<void>;
|
|
457
|
+
blocklist(): Promise<string[]>;
|
|
458
|
+
getSettings(): Promise<{
|
|
459
|
+
[_: string]: string;
|
|
460
|
+
}>;
|
|
461
|
+
}
|
|
462
|
+
declare class SignalPrivacy {
|
|
463
|
+
protected plient: Client;
|
|
464
|
+
privacy: Privacy;
|
|
465
|
+
constructor(plient: Client);
|
|
466
|
+
}
|
|
467
|
+
|
|
468
|
+
declare class Newsletter {
|
|
469
|
+
protected client: Client;
|
|
470
|
+
constructor(client: Client);
|
|
471
|
+
create(name: string, description: string): Promise<baileys.NewsletterMetadata>;
|
|
472
|
+
action(roomId: string, type: 'follow' | 'unfollow' | 'mute' | 'unmute' | ''): Promise<unknown>;
|
|
473
|
+
update(roomId: string, update: string | Buffer, type: 'name' | 'description' | 'picture'): Promise<unknown>;
|
|
474
|
+
metadata(roomId: string, type: 'invite' | 'jid'): Promise<baileys.NewsletterMetadata>;
|
|
475
|
+
subscribers(roomId: string): Promise<{
|
|
476
|
+
subscribers: number;
|
|
477
|
+
}>;
|
|
478
|
+
reaction(roomId: string, chatId: string, reaction: string): Promise<void>;
|
|
479
|
+
fetchMessages(roomId: string, count: number, since: Date, after: Date): Promise<any>;
|
|
480
|
+
adminCount(roomId: string): Promise<number>;
|
|
481
|
+
changeOwner(roomId: string, owner: string): Promise<void>;
|
|
482
|
+
demote(roomId: string, senderId: string): Promise<void>;
|
|
483
|
+
delete(roomId: string): Promise<void>;
|
|
484
|
+
removePicture(roomId: string): Promise<unknown>;
|
|
485
|
+
}
|
|
486
|
+
declare class SignalNewsletter {
|
|
487
|
+
protected nlient: Client;
|
|
488
|
+
newsletter: Newsletter;
|
|
489
|
+
constructor(nlient: Client);
|
|
490
|
+
}
|
|
491
|
+
|
|
492
|
+
declare class Community {
|
|
493
|
+
protected client: Client;
|
|
494
|
+
constructor(client: Client);
|
|
495
|
+
create(subject: string, description: string): Promise<baileys.GroupMetadata>;
|
|
496
|
+
createGroup(subject: string, participants: string[], parentId: string): Promise<baileys.GroupMetadata>;
|
|
497
|
+
leave(id: string): Promise<void>;
|
|
498
|
+
metadata(id: string): Promise<baileys.GroupMetadata>;
|
|
499
|
+
update(id: string, type: 'subject' | 'description', value: string): Promise<void>;
|
|
500
|
+
group(id: string, type: 'link' | 'unlink' | 'linked', groupJid?: string): Promise<void | {
|
|
501
|
+
communityJid: string;
|
|
502
|
+
isCommunity: boolean;
|
|
503
|
+
linkedGroups: {
|
|
504
|
+
id: string | undefined;
|
|
505
|
+
subject: string;
|
|
506
|
+
creation: number | undefined;
|
|
507
|
+
owner: string | undefined;
|
|
508
|
+
size: number | undefined;
|
|
509
|
+
}[];
|
|
510
|
+
}>;
|
|
511
|
+
participants(id: string, type: 'list' | 'request-update' | 'update' | 'all', action?: 'add' | 'remove' | 'promote' | 'demote' | 'approve' | 'reject', participants?: string[]): Promise<{
|
|
512
|
+
[key: string]: string;
|
|
513
|
+
}[] | {
|
|
514
|
+
status: string;
|
|
515
|
+
jid: string | undefined;
|
|
516
|
+
}[] | {
|
|
517
|
+
[_: string]: baileys.GroupMetadata;
|
|
518
|
+
}>;
|
|
519
|
+
invite(target: string | any, type: 'code' | 'revoke' | 'accept' | 'info' | 'revokeV4' | 'acceptV4', ...args: any[]): Promise<any>;
|
|
520
|
+
settings(id: string, type: 'ephemeral' | 'update' | 'memberAdd' | 'approval', value?: any): Promise<void>;
|
|
521
|
+
}
|
|
522
|
+
declare class SignalCommunity {
|
|
523
|
+
protected mlient: Client;
|
|
524
|
+
community: Community;
|
|
525
|
+
constructor(mlient: Client);
|
|
526
|
+
}
|
|
527
|
+
|
|
528
|
+
interface Client extends Signal, SignalGroup, SignalPrivacy, SignalNewsletter, SignalCommunity {
|
|
445
529
|
}
|
|
446
530
|
declare class Client {
|
|
447
531
|
options: z.infer<typeof ClientOptionsType>;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as baileys from 'baileys';
|
|
2
|
-
import { AuthenticationState, WAMessage, proto, ParticipantAction } from 'baileys';
|
|
2
|
+
import { AuthenticationState, WAMessage, proto, ParticipantAction, WAPrivacyValue, WAPrivacyOnlineValue, WAReadReceiptsValue, WAPrivacyGroupAddValue } from 'baileys';
|
|
3
3
|
import z, { z as z$1 } from 'zod';
|
|
4
4
|
import _ from 'lodash';
|
|
5
5
|
|
|
@@ -94,6 +94,7 @@ declare const ButtonOptionsType: z.ZodIntersection<z.ZodObject<{
|
|
|
94
94
|
text: z.ZodString;
|
|
95
95
|
section: z.ZodArray<z.ZodObject<{
|
|
96
96
|
title: z.ZodString;
|
|
97
|
+
highlight_label: z.ZodOptional<z.ZodString>;
|
|
97
98
|
rows: z.ZodArray<z.ZodObject<{
|
|
98
99
|
id: z.ZodString;
|
|
99
100
|
title: z.ZodString;
|
|
@@ -129,18 +130,18 @@ declare class Signal {
|
|
|
129
130
|
declare class Group {
|
|
130
131
|
protected client: Client;
|
|
131
132
|
constructor(client: Client);
|
|
132
|
-
create(name: string, participants:
|
|
133
|
-
participant(roomId: string, participants:
|
|
133
|
+
create(name: string, participants: string[]): Promise<baileys.GroupMetadata>;
|
|
134
|
+
participant(roomId: string, participants: string[], action: ParticipantAction): Promise<{
|
|
134
135
|
status: string;
|
|
135
136
|
jid: string | undefined;
|
|
136
137
|
content: baileys.BinaryNode;
|
|
137
138
|
}[]>;
|
|
138
|
-
profile(roomId: string, update: string | Buffer, type: 'subject' | 'description' | '
|
|
139
|
+
profile(roomId: string, update: string | Buffer, type: 'subject' | 'description' | 'picture'): Promise<void>;
|
|
139
140
|
setting(roomId: string, type: 'open' | 'close' | 'locked' | 'unlocked' | 'all_member_add' | 'admin_add'): Promise<void>;
|
|
140
141
|
leave(roomId: string): Promise<void>;
|
|
141
142
|
inviteCode(roomId: string, type: 'code' | 'revoke' | 'accept' | 'info'): Promise<string | baileys.GroupMetadata>;
|
|
142
143
|
metadata(roomId: string): Promise<baileys.GroupMetadata>;
|
|
143
|
-
requestJoin(roomId: string, participants:
|
|
144
|
+
requestJoin(roomId: string, participants: string[], type: 'approve' | 'reject'): Promise<{
|
|
144
145
|
status: string;
|
|
145
146
|
jid: string | undefined;
|
|
146
147
|
}[]>;
|
|
@@ -441,7 +442,90 @@ declare class Plugins {
|
|
|
441
442
|
}
|
|
442
443
|
declare const definePlugins: (handler: PluginsHandlerType, config: PluginsConfigType) => PluginDefinition;
|
|
443
444
|
|
|
444
|
-
|
|
445
|
+
declare class Privacy {
|
|
446
|
+
protected client: Client;
|
|
447
|
+
constructor(client: Client);
|
|
448
|
+
block(senderId: string): Promise<void>;
|
|
449
|
+
unblock(senderId: string): Promise<void>;
|
|
450
|
+
lastSeen(type: WAPrivacyValue): Promise<void>;
|
|
451
|
+
online(type: WAPrivacyOnlineValue): Promise<void>;
|
|
452
|
+
picture(type: WAPrivacyValue): Promise<void>;
|
|
453
|
+
status(type: WAPrivacyValue): Promise<void>;
|
|
454
|
+
readReceipt(type: WAReadReceiptsValue): Promise<void>;
|
|
455
|
+
groupsAdd(type: WAPrivacyGroupAddValue): Promise<void>;
|
|
456
|
+
ephemeral(type: 'off' | '24h' | '7d' | '90d'): Promise<void>;
|
|
457
|
+
blocklist(): Promise<string[]>;
|
|
458
|
+
getSettings(): Promise<{
|
|
459
|
+
[_: string]: string;
|
|
460
|
+
}>;
|
|
461
|
+
}
|
|
462
|
+
declare class SignalPrivacy {
|
|
463
|
+
protected plient: Client;
|
|
464
|
+
privacy: Privacy;
|
|
465
|
+
constructor(plient: Client);
|
|
466
|
+
}
|
|
467
|
+
|
|
468
|
+
declare class Newsletter {
|
|
469
|
+
protected client: Client;
|
|
470
|
+
constructor(client: Client);
|
|
471
|
+
create(name: string, description: string): Promise<baileys.NewsletterMetadata>;
|
|
472
|
+
action(roomId: string, type: 'follow' | 'unfollow' | 'mute' | 'unmute' | ''): Promise<unknown>;
|
|
473
|
+
update(roomId: string, update: string | Buffer, type: 'name' | 'description' | 'picture'): Promise<unknown>;
|
|
474
|
+
metadata(roomId: string, type: 'invite' | 'jid'): Promise<baileys.NewsletterMetadata>;
|
|
475
|
+
subscribers(roomId: string): Promise<{
|
|
476
|
+
subscribers: number;
|
|
477
|
+
}>;
|
|
478
|
+
reaction(roomId: string, chatId: string, reaction: string): Promise<void>;
|
|
479
|
+
fetchMessages(roomId: string, count: number, since: Date, after: Date): Promise<any>;
|
|
480
|
+
adminCount(roomId: string): Promise<number>;
|
|
481
|
+
changeOwner(roomId: string, owner: string): Promise<void>;
|
|
482
|
+
demote(roomId: string, senderId: string): Promise<void>;
|
|
483
|
+
delete(roomId: string): Promise<void>;
|
|
484
|
+
removePicture(roomId: string): Promise<unknown>;
|
|
485
|
+
}
|
|
486
|
+
declare class SignalNewsletter {
|
|
487
|
+
protected nlient: Client;
|
|
488
|
+
newsletter: Newsletter;
|
|
489
|
+
constructor(nlient: Client);
|
|
490
|
+
}
|
|
491
|
+
|
|
492
|
+
declare class Community {
|
|
493
|
+
protected client: Client;
|
|
494
|
+
constructor(client: Client);
|
|
495
|
+
create(subject: string, description: string): Promise<baileys.GroupMetadata>;
|
|
496
|
+
createGroup(subject: string, participants: string[], parentId: string): Promise<baileys.GroupMetadata>;
|
|
497
|
+
leave(id: string): Promise<void>;
|
|
498
|
+
metadata(id: string): Promise<baileys.GroupMetadata>;
|
|
499
|
+
update(id: string, type: 'subject' | 'description', value: string): Promise<void>;
|
|
500
|
+
group(id: string, type: 'link' | 'unlink' | 'linked', groupJid?: string): Promise<void | {
|
|
501
|
+
communityJid: string;
|
|
502
|
+
isCommunity: boolean;
|
|
503
|
+
linkedGroups: {
|
|
504
|
+
id: string | undefined;
|
|
505
|
+
subject: string;
|
|
506
|
+
creation: number | undefined;
|
|
507
|
+
owner: string | undefined;
|
|
508
|
+
size: number | undefined;
|
|
509
|
+
}[];
|
|
510
|
+
}>;
|
|
511
|
+
participants(id: string, type: 'list' | 'request-update' | 'update' | 'all', action?: 'add' | 'remove' | 'promote' | 'demote' | 'approve' | 'reject', participants?: string[]): Promise<{
|
|
512
|
+
[key: string]: string;
|
|
513
|
+
}[] | {
|
|
514
|
+
status: string;
|
|
515
|
+
jid: string | undefined;
|
|
516
|
+
}[] | {
|
|
517
|
+
[_: string]: baileys.GroupMetadata;
|
|
518
|
+
}>;
|
|
519
|
+
invite(target: string | any, type: 'code' | 'revoke' | 'accept' | 'info' | 'revokeV4' | 'acceptV4', ...args: any[]): Promise<any>;
|
|
520
|
+
settings(id: string, type: 'ephemeral' | 'update' | 'memberAdd' | 'approval', value?: any): Promise<void>;
|
|
521
|
+
}
|
|
522
|
+
declare class SignalCommunity {
|
|
523
|
+
protected mlient: Client;
|
|
524
|
+
community: Community;
|
|
525
|
+
constructor(mlient: Client);
|
|
526
|
+
}
|
|
527
|
+
|
|
528
|
+
interface Client extends Signal, SignalGroup, SignalPrivacy, SignalNewsletter, SignalCommunity {
|
|
445
529
|
}
|
|
446
530
|
declare class Client {
|
|
447
531
|
options: z.infer<typeof ClientOptionsType>;
|