zaileys 4.7.0 → 4.7.2
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 +5 -0
- package/dist/auth/adapters/convex.d.ts +9 -0
- package/dist/auth/adapters/file.d.ts +16 -0
- package/dist/auth/adapters/index.d.ts +6 -0
- package/dist/auth/adapters/memory.d.ts +9 -0
- package/dist/auth/adapters/postgres.d.ts +20 -0
- package/dist/auth/adapters/redis.d.ts +27 -0
- package/dist/auth/adapters/sqlite.d.ts +19 -0
- package/dist/auth/cache.d.ts +11 -0
- package/dist/auth/index.d.ts +3 -0
- package/dist/auth/types.d.ts +21 -0
- package/dist/automation/auto-delete.d.ts +30 -0
- package/dist/automation/broadcast.d.ts +10 -0
- package/dist/automation/errors.d.ts +8 -0
- package/dist/automation/index.d.ts +11 -0
- package/dist/automation/operation-guard.d.ts +20 -0
- package/dist/automation/presence.d.ts +28 -0
- package/dist/automation/queue.d.ts +18 -0
- package/dist/automation/rate-limiter.d.ts +18 -0
- package/dist/automation/schedule.d.ts +45 -0
- package/dist/automation/types.d.ts +31 -0
- package/dist/builder/album.d.ts +4 -0
- package/dist/builder/builder.d.ts +59 -0
- package/dist/builder/content/airich.d.ts +80 -0
- package/dist/builder/content/audio.d.ts +9 -0
- package/dist/builder/content/buttons.d.ts +30 -0
- package/dist/builder/content/carousel.d.ts +19 -0
- package/dist/builder/content/contact.d.ts +13 -0
- package/dist/builder/content/document.d.ts +9 -0
- package/dist/builder/content/event.d.ts +3 -0
- package/dist/builder/content/group-invite.d.ts +3 -0
- package/dist/builder/content/image.d.ts +8 -0
- package/dist/builder/content/list.d.ts +14 -0
- package/dist/builder/content/location.d.ts +11 -0
- package/dist/builder/content/markdown.d.ts +2 -0
- package/dist/builder/content/poll.d.ts +10 -0
- package/dist/builder/content/product.d.ts +3 -0
- package/dist/builder/content/sticker.d.ts +7 -0
- package/dist/builder/content/template.d.ts +3 -0
- package/dist/builder/content/text.d.ts +4 -0
- package/dist/builder/content/video.d.ts +10 -0
- package/dist/builder/edit-builder.d.ts +15 -0
- package/dist/builder/errors.d.ts +8 -0
- package/dist/builder/index.d.ts +6 -0
- package/dist/builder/media-loader.d.ts +11 -0
- package/dist/builder/mutations.d.ts +14 -0
- package/dist/builder/state.d.ts +15 -0
- package/dist/builder/types.d.ts +164 -0
- package/dist/builder/username-resolve.d.ts +8 -0
- package/dist/client/client.d.ts +130 -0
- package/dist/client/event-emitter.d.ts +19 -0
- package/dist/client/index.d.ts +3 -0
- package/dist/client/types.d.ts +104 -0
- package/dist/command/dispatcher.d.ts +23 -0
- package/dist/command/errors.d.ts +8 -0
- package/dist/command/index.d.ts +7 -0
- package/dist/command/middleware.d.ts +2 -0
- package/dist/command/parser.d.ts +2 -0
- package/dist/command/registry.d.ts +13 -0
- package/dist/command/types.d.ts +30 -0
- package/dist/connection/auth-adapter.d.ts +4 -0
- package/dist/connection/auth-guard.d.ts +37 -0
- package/dist/connection/disconnect-reason.d.ts +6 -0
- package/dist/connection/index.d.ts +7 -0
- package/dist/connection/pairing-flow.d.ts +16 -0
- package/dist/connection/qr-terminal.d.ts +2 -0
- package/dist/connection/reconnect.d.ts +15 -0
- package/dist/connection/state-machine.d.ts +9 -0
- package/dist/connection/status-log.d.ts +25 -0
- package/dist/domain/business.d.ts +19 -0
- package/dist/domain/chat.d.ts +27 -0
- package/dist/domain/community.d.ts +28 -0
- package/dist/domain/contact.d.ts +21 -0
- package/dist/domain/errors.d.ts +8 -0
- package/dist/domain/group.d.ts +35 -0
- package/dist/domain/index.d.ts +11 -0
- package/dist/domain/newsletter.d.ts +35 -0
- package/dist/domain/privacy.d.ts +15 -0
- package/dist/domain/profile.d.ts +14 -0
- package/dist/domain/socket-like.d.ts +117 -0
- package/dist/domain/types.d.ts +24 -0
- package/dist/events/context.d.ts +238 -0
- package/dist/events/decoders/_media-download.d.ts +8 -0
- package/dist/events/decoders/_shared.d.ts +26 -0
- package/dist/events/decoders/calls.d.ts +11 -0
- package/dist/events/decoders/groups.d.ts +36 -0
- package/dist/events/decoders/interactive.d.ts +9 -0
- package/dist/events/decoders/lifecycle.d.ts +69 -0
- package/dist/events/decoders/messages.d.ts +30 -0
- package/dist/events/decoders/mutations.d.ts +24 -0
- package/dist/events/guards.d.ts +9 -0
- package/dist/events/index.d.ts +4 -0
- package/dist/events/pipeline.d.ts +37 -0
- package/dist/events/types.d.ts +187 -0
- package/dist/index.cjs +8 -8
- package/dist/index.d.ts +14 -2264
- package/dist/index.mjs +8 -8
- package/dist/media/ffmpeg/audio.d.ts +12 -0
- package/dist/media/ffmpeg/core.d.ts +67 -0
- package/dist/media/ffmpeg/document.d.ts +10 -0
- package/dist/media/ffmpeg/image.d.ts +7 -0
- package/dist/media/ffmpeg/index.d.ts +7 -0
- package/dist/media/ffmpeg/sticker.d.ts +14 -0
- package/dist/media/ffmpeg/transform.d.ts +2 -0
- package/dist/media/ffmpeg/video.d.ts +6 -0
- package/dist/media/index.d.ts +2 -0
- package/dist/media/media.d.ts +39 -0
- package/dist/plugin/index.d.ts +5 -0
- package/dist/plugin/loader.d.ts +30 -0
- package/dist/plugin/registry.d.ts +24 -0
- package/dist/plugin/types.d.ts +25 -0
- package/dist/store/adapters/convex.d.ts +33 -0
- package/dist/store/adapters/index.d.ts +5 -0
- package/dist/store/adapters/memory.d.ts +31 -0
- package/dist/store/adapters/postgres.d.ts +40 -0
- package/dist/store/adapters/redis.d.ts +49 -0
- package/dist/store/adapters/sqlite.d.ts +36 -0
- package/dist/store/index.d.ts +2 -0
- package/dist/store/types.d.ts +48 -0
- package/dist/types/convex.d.ts +35 -0
- package/dist/types/index.d.ts +4 -0
- package/dist/types/lid-mapping.d.ts +5 -0
- package/dist/types/optional-clients.d.ts +69 -0
- package/dist/types/store-error.d.ts +8 -0
- package/dist/utils/array.d.ts +1 -0
- package/dist/utils/index.d.ts +5 -0
- package/dist/utils/jid.d.ts +6 -0
- package/dist/utils/logger.d.ts +10 -0
- package/package.json +5 -7
- package/dist/index.d.cts +0 -2264
|
@@ -0,0 +1,238 @@
|
|
|
1
|
+
import { type WAMessage, type WAMessageKey } from 'baileys';
|
|
2
|
+
import { Readable } from 'node:stream';
|
|
3
|
+
import type { SenderInfo } from './types.js';
|
|
4
|
+
import type { TextOptions } from '../builder/builder.js';
|
|
5
|
+
export type ChatType = 'text' | 'image' | 'video' | 'audio' | 'document' | 'sticker' | 'poll' | 'contact' | 'location' | 'live-location' | 'event' | 'album' | 'group-invite' | 'product' | 'order' | 'payment' | 'buttons' | 'list' | 'interactive' | 'template' | 'unknown';
|
|
6
|
+
export type SenderDevice = 'unknown' | 'android' | 'ios' | 'web' | 'desktop' | string;
|
|
7
|
+
export interface CitationConfig {
|
|
8
|
+
authors?: string[] | ((jid: string) => boolean | Promise<boolean>);
|
|
9
|
+
banned?: string[] | ((jid: string) => boolean | Promise<boolean>);
|
|
10
|
+
}
|
|
11
|
+
export interface CitationPredicates {
|
|
12
|
+
authors(): Promise<boolean>;
|
|
13
|
+
banned(): Promise<boolean>;
|
|
14
|
+
}
|
|
15
|
+
export interface MediaAttachment {
|
|
16
|
+
type: 'image' | 'video' | 'audio' | 'document' | 'sticker';
|
|
17
|
+
mimetype: string | null;
|
|
18
|
+
caption: string | null;
|
|
19
|
+
fileName: string | null;
|
|
20
|
+
fileSize: number | null;
|
|
21
|
+
ptt: boolean;
|
|
22
|
+
buffer(): Promise<Buffer>;
|
|
23
|
+
stream(): Promise<Readable>;
|
|
24
|
+
}
|
|
25
|
+
export interface PollMedia {
|
|
26
|
+
type: 'poll';
|
|
27
|
+
name: string | null;
|
|
28
|
+
options: string[];
|
|
29
|
+
selectableCount: number;
|
|
30
|
+
}
|
|
31
|
+
export interface ContactCard {
|
|
32
|
+
displayName: string | null;
|
|
33
|
+
vcard: string | null;
|
|
34
|
+
}
|
|
35
|
+
export interface ContactMedia {
|
|
36
|
+
type: 'contact';
|
|
37
|
+
displayName: string | null;
|
|
38
|
+
vcard: string | null;
|
|
39
|
+
contacts: ContactCard[];
|
|
40
|
+
}
|
|
41
|
+
export interface LocationMedia {
|
|
42
|
+
type: 'location' | 'live-location';
|
|
43
|
+
latitude: number | null;
|
|
44
|
+
longitude: number | null;
|
|
45
|
+
name: string | null;
|
|
46
|
+
address: string | null;
|
|
47
|
+
accuracy: number | null;
|
|
48
|
+
speed: number | null;
|
|
49
|
+
caption: string | null;
|
|
50
|
+
}
|
|
51
|
+
export interface AlbumMedia {
|
|
52
|
+
type: 'album';
|
|
53
|
+
expectedImageCount: number | null;
|
|
54
|
+
expectedVideoCount: number | null;
|
|
55
|
+
}
|
|
56
|
+
export interface GroupInviteMedia {
|
|
57
|
+
type: 'group-invite';
|
|
58
|
+
groupId: string | null;
|
|
59
|
+
groupName: string | null;
|
|
60
|
+
inviteCode: string | null;
|
|
61
|
+
caption: string | null;
|
|
62
|
+
expiresAt: number | null;
|
|
63
|
+
}
|
|
64
|
+
export interface ProductMedia {
|
|
65
|
+
type: 'product';
|
|
66
|
+
productId: string | null;
|
|
67
|
+
title: string | null;
|
|
68
|
+
description: string | null;
|
|
69
|
+
price: number | null;
|
|
70
|
+
currency: string | null;
|
|
71
|
+
retailerId: string | null;
|
|
72
|
+
url: string | null;
|
|
73
|
+
businessOwnerId: string | null;
|
|
74
|
+
}
|
|
75
|
+
export interface OrderMedia {
|
|
76
|
+
type: 'order';
|
|
77
|
+
orderId: string | null;
|
|
78
|
+
title: string | null;
|
|
79
|
+
itemCount: number | null;
|
|
80
|
+
total: number | null;
|
|
81
|
+
currency: string | null;
|
|
82
|
+
status: string | null;
|
|
83
|
+
message: string | null;
|
|
84
|
+
}
|
|
85
|
+
export interface PaymentMedia {
|
|
86
|
+
type: 'payment';
|
|
87
|
+
kind: 'request' | 'send' | 'invite';
|
|
88
|
+
amount: number | null;
|
|
89
|
+
currency: string | null;
|
|
90
|
+
note: string | null;
|
|
91
|
+
expiresAt: number | null;
|
|
92
|
+
}
|
|
93
|
+
export interface LinkPreviewMedia {
|
|
94
|
+
type: 'link';
|
|
95
|
+
url: string | null;
|
|
96
|
+
title: string | null;
|
|
97
|
+
description: string | null;
|
|
98
|
+
}
|
|
99
|
+
export interface EventMedia {
|
|
100
|
+
type: 'event';
|
|
101
|
+
name: string | null;
|
|
102
|
+
description: string | null;
|
|
103
|
+
location: string | null;
|
|
104
|
+
startTime: number | null;
|
|
105
|
+
endTime: number | null;
|
|
106
|
+
isCanceled: boolean;
|
|
107
|
+
}
|
|
108
|
+
export interface MessageButton {
|
|
109
|
+
id: string | null;
|
|
110
|
+
text: string | null;
|
|
111
|
+
}
|
|
112
|
+
export interface ButtonsMedia {
|
|
113
|
+
type: 'buttons';
|
|
114
|
+
contentText: string | null;
|
|
115
|
+
footerText: string | null;
|
|
116
|
+
buttons: MessageButton[];
|
|
117
|
+
}
|
|
118
|
+
export interface ListRow {
|
|
119
|
+
id: string | null;
|
|
120
|
+
title: string | null;
|
|
121
|
+
description: string | null;
|
|
122
|
+
}
|
|
123
|
+
export interface ListSection {
|
|
124
|
+
title: string | null;
|
|
125
|
+
rows: ListRow[];
|
|
126
|
+
}
|
|
127
|
+
export interface ListMedia {
|
|
128
|
+
type: 'list';
|
|
129
|
+
title: string | null;
|
|
130
|
+
description: string | null;
|
|
131
|
+
buttonText: string | null;
|
|
132
|
+
sections: ListSection[];
|
|
133
|
+
}
|
|
134
|
+
export interface InteractiveMedia {
|
|
135
|
+
type: 'interactive';
|
|
136
|
+
title: string | null;
|
|
137
|
+
body: string | null;
|
|
138
|
+
footer: string | null;
|
|
139
|
+
buttons: Array<{
|
|
140
|
+
name: string | null;
|
|
141
|
+
params: string | null;
|
|
142
|
+
}>;
|
|
143
|
+
}
|
|
144
|
+
export interface TemplateMedia {
|
|
145
|
+
type: 'template';
|
|
146
|
+
text: string | null;
|
|
147
|
+
buttons: MessageButton[];
|
|
148
|
+
}
|
|
149
|
+
export type ContextMedia = MediaAttachment | PollMedia | ContactMedia | LocationMedia | EventMedia | AlbumMedia | GroupInviteMedia | ProductMedia | OrderMedia | PaymentMedia | LinkPreviewMedia | ButtonsMedia | ListMedia | InteractiveMedia | TemplateMedia;
|
|
150
|
+
export interface MessageContext {
|
|
151
|
+
uniqueId: string;
|
|
152
|
+
staticId: string;
|
|
153
|
+
channelId: string;
|
|
154
|
+
chatId: string;
|
|
155
|
+
chatType: ChatType;
|
|
156
|
+
receiverId: string;
|
|
157
|
+
roomId: string | null;
|
|
158
|
+
senderId: string;
|
|
159
|
+
senderLid: string | null;
|
|
160
|
+
senderName: string | null;
|
|
161
|
+
senderDevice: SenderDevice;
|
|
162
|
+
timestamp: number;
|
|
163
|
+
text: string;
|
|
164
|
+
mentions: string[];
|
|
165
|
+
links: string[];
|
|
166
|
+
isFromMe: boolean;
|
|
167
|
+
isGroup: boolean;
|
|
168
|
+
isNewsletter: boolean;
|
|
169
|
+
isBroadcast: boolean;
|
|
170
|
+
isViewOnce: boolean;
|
|
171
|
+
isEphemeral: boolean;
|
|
172
|
+
isForwarded: boolean;
|
|
173
|
+
isQuestion: boolean;
|
|
174
|
+
isPrefix: boolean;
|
|
175
|
+
isTagMe: boolean;
|
|
176
|
+
isEdited: boolean;
|
|
177
|
+
isDeleted: boolean;
|
|
178
|
+
isPinned: boolean;
|
|
179
|
+
isUnPinned: boolean;
|
|
180
|
+
isBot: boolean;
|
|
181
|
+
isSpam: boolean;
|
|
182
|
+
isHideTags: boolean;
|
|
183
|
+
isStatusMention: boolean;
|
|
184
|
+
isGroupStatusMention: boolean;
|
|
185
|
+
isStory: boolean;
|
|
186
|
+
roomName(): Promise<string | null>;
|
|
187
|
+
receiverName(): Promise<string | null>;
|
|
188
|
+
media?: ContextMedia;
|
|
189
|
+
replied(): Promise<MessageContext | null>;
|
|
190
|
+
message(): WAMessage;
|
|
191
|
+
citation: CitationPredicates;
|
|
192
|
+
reply(content: string, opts?: TextOptions): Promise<WAMessageKey>;
|
|
193
|
+
react(emoji: string): Promise<WAMessageKey>;
|
|
194
|
+
}
|
|
195
|
+
export interface MentionContext extends MessageContext {
|
|
196
|
+
mentionedJids: string[];
|
|
197
|
+
selfJid: string;
|
|
198
|
+
}
|
|
199
|
+
export interface MentionAllContext extends MessageContext {
|
|
200
|
+
isMentionAll: true;
|
|
201
|
+
selfJid: string;
|
|
202
|
+
members?: string[];
|
|
203
|
+
}
|
|
204
|
+
export interface BuildContextInput {
|
|
205
|
+
message: WAMessage;
|
|
206
|
+
key: WAMessageKey;
|
|
207
|
+
channelId: string;
|
|
208
|
+
receiverId: string;
|
|
209
|
+
selfJid: string;
|
|
210
|
+
text: string;
|
|
211
|
+
chatType: ChatType;
|
|
212
|
+
sender: SenderInfo;
|
|
213
|
+
mentions: string[];
|
|
214
|
+
isViewOnce: boolean;
|
|
215
|
+
isEphemeral: boolean;
|
|
216
|
+
isForwarded: boolean;
|
|
217
|
+
isBroadcast: boolean;
|
|
218
|
+
isNewsletter: boolean;
|
|
219
|
+
prefixes: string[];
|
|
220
|
+
citationConfig?: CitationConfig;
|
|
221
|
+
lidMap?: Map<string, string>;
|
|
222
|
+
resolveRoomName: () => Promise<string | null>;
|
|
223
|
+
resolveReceiverName: () => Promise<string | null>;
|
|
224
|
+
resolveReplied: () => Promise<MessageContext | null>;
|
|
225
|
+
reply: (content: string, opts?: TextOptions) => Promise<WAMessageKey>;
|
|
226
|
+
react: (emoji: string) => Promise<WAMessageKey>;
|
|
227
|
+
media?: ContextMedia;
|
|
228
|
+
}
|
|
229
|
+
export declare const extractLinks: (text: string) => string[];
|
|
230
|
+
export declare const computeUniqueId: (key: WAMessageKey) => string;
|
|
231
|
+
export declare const computeStaticId: (roomId: string | null, senderId: string) => string;
|
|
232
|
+
export declare const epochSecondsToMs: (value: unknown) => number;
|
|
233
|
+
export declare const senderDeviceOf: (jid: string) => SenderDevice;
|
|
234
|
+
export declare const isQuestionOf: (text: string) => boolean;
|
|
235
|
+
export declare const isPrefixOf: (text: string, prefixes: string[]) => boolean;
|
|
236
|
+
export declare const isTagMeOf: (selfJid: string, mentions: string[]) => boolean;
|
|
237
|
+
export declare const makeCitation: (config: CitationConfig | undefined, senderJid: string) => CitationPredicates;
|
|
238
|
+
export declare const buildMessageContext: (input: BuildContextInput) => MessageContext;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { Readable } from 'node:stream';
|
|
2
|
+
import type { WAMessage } from 'baileys';
|
|
3
|
+
import type { MediaDownloadResult, MediaKind } from '../types.js';
|
|
4
|
+
export interface DownloadLogger {
|
|
5
|
+
warn(obj: unknown, msg?: string): void;
|
|
6
|
+
}
|
|
7
|
+
export declare const createDownloadFn: (msg: WAMessage, kind: MediaKind, logger?: DownloadLogger) => (() => Promise<MediaDownloadResult>);
|
|
8
|
+
export declare const createStreamFn: (msg: WAMessage, kind: MediaKind, logger?: DownloadLogger) => (() => Promise<Readable>);
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { type WAContextInfo, type WAMessageKey } from 'baileys';
|
|
2
|
+
import type { QuotedRef, SenderInfo } from '../types.js';
|
|
3
|
+
export interface LongLike {
|
|
4
|
+
toNumber(): number;
|
|
5
|
+
low: number;
|
|
6
|
+
high: number;
|
|
7
|
+
}
|
|
8
|
+
export interface AddressingAliases {
|
|
9
|
+
remoteJidAlt?: string;
|
|
10
|
+
remoteJidUsername?: string;
|
|
11
|
+
participantAlt?: string;
|
|
12
|
+
participantUsername?: string;
|
|
13
|
+
}
|
|
14
|
+
export interface ExtractedMentions {
|
|
15
|
+
mentionedJids: string[];
|
|
16
|
+
mentionAll: boolean;
|
|
17
|
+
}
|
|
18
|
+
export declare const extractJid: (remoteJid: string | undefined | null) => string | null;
|
|
19
|
+
export declare const isLidJid: (jid: string) => boolean;
|
|
20
|
+
export declare const isPnJid: (jid: string) => boolean;
|
|
21
|
+
export declare const extractSender: (key: WAMessageKey | undefined, pushName?: string) => SenderInfo | null;
|
|
22
|
+
export declare const extractQuoted: (contextInfo: WAContextInfo | null | undefined) => QuotedRef | null;
|
|
23
|
+
export declare const extractMentions: (contextInfo: WAContextInfo | null | undefined) => ExtractedMentions;
|
|
24
|
+
export declare const mapAddressing: (key: WAMessageKey) => AddressingAliases;
|
|
25
|
+
export declare const isGroupJid: (jid: string) => boolean;
|
|
26
|
+
export declare const safeNumber: (n: number | LongLike | null | undefined) => number | null;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { WACallEvent } from 'baileys';
|
|
2
|
+
import type { CallPayload } from '../types.js';
|
|
3
|
+
type IncomingCall = Extract<CallPayload, {
|
|
4
|
+
kind: 'incoming';
|
|
5
|
+
}>;
|
|
6
|
+
type EndedCall = Extract<CallPayload, {
|
|
7
|
+
kind: 'ended';
|
|
8
|
+
}>;
|
|
9
|
+
export declare const decodeCallIncoming: (item: WACallEvent) => IncomingCall | null;
|
|
10
|
+
export declare const decodeCallEnded: (item: WACallEvent) => EndedCall | null;
|
|
11
|
+
export {};
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import type { GroupJoinPayload, GroupLeavePayload, GroupUpdatePayload, MemberTagPayload } from '../types.js';
|
|
2
|
+
export interface GroupMetadataUpdate {
|
|
3
|
+
id?: string;
|
|
4
|
+
subject?: string;
|
|
5
|
+
desc?: string;
|
|
6
|
+
announce?: boolean;
|
|
7
|
+
restrict?: boolean;
|
|
8
|
+
ephemeralDuration?: number;
|
|
9
|
+
}
|
|
10
|
+
export interface RawGroupParticipant {
|
|
11
|
+
id: string;
|
|
12
|
+
lid?: string;
|
|
13
|
+
pn?: string;
|
|
14
|
+
phoneNumber?: string;
|
|
15
|
+
username?: string;
|
|
16
|
+
admin?: 'admin' | 'superadmin' | null;
|
|
17
|
+
}
|
|
18
|
+
export interface GroupParticipantsUpdate {
|
|
19
|
+
id?: string;
|
|
20
|
+
author?: string;
|
|
21
|
+
authorPn?: string;
|
|
22
|
+
authorUsername?: string;
|
|
23
|
+
participants: RawGroupParticipant[];
|
|
24
|
+
action: string;
|
|
25
|
+
}
|
|
26
|
+
export interface MemberTagUpdate {
|
|
27
|
+
groupId?: string;
|
|
28
|
+
participant?: string;
|
|
29
|
+
participantAlt?: string;
|
|
30
|
+
label?: string;
|
|
31
|
+
messageTimestamp?: number;
|
|
32
|
+
}
|
|
33
|
+
export declare const decodeGroupUpdate: (item: GroupMetadataUpdate) => GroupUpdatePayload | null;
|
|
34
|
+
export declare const decodeMemberTag: (item: MemberTagUpdate) => MemberTagPayload | null;
|
|
35
|
+
export declare const decodeGroupJoin: (item: GroupParticipantsUpdate) => GroupJoinPayload | null;
|
|
36
|
+
export declare const decodeGroupLeave: (item: GroupParticipantsUpdate) => GroupLeavePayload | null;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { WAMessage } from 'baileys';
|
|
2
|
+
import type { Logger } from '../../client/types.js';
|
|
3
|
+
import type { ButtonClickPayload, ListSelectPayload } from '../types.js';
|
|
4
|
+
export interface InteractiveContext {
|
|
5
|
+
selfJid: string;
|
|
6
|
+
logger?: Logger;
|
|
7
|
+
}
|
|
8
|
+
export declare const decodeButtonClick: (msg: WAMessage, ctx: InteractiveContext) => ButtonClickPayload | null;
|
|
9
|
+
export declare const decodeListSelect: (msg: WAMessage, ctx: InteractiveContext) => ListSelectPayload | null;
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import type { HistorySyncPayload, LimitedPayload, NewsletterPayload, PresencePayload } from '../types.js';
|
|
2
|
+
export interface RawHistorySync {
|
|
3
|
+
syncType: number | string;
|
|
4
|
+
status: string;
|
|
5
|
+
explicit: boolean;
|
|
6
|
+
}
|
|
7
|
+
export interface RawReachoutTimelock {
|
|
8
|
+
isActive?: boolean;
|
|
9
|
+
timeEnforcementEnds?: Date | number;
|
|
10
|
+
enforcementType?: string;
|
|
11
|
+
}
|
|
12
|
+
export interface RawCapInfo {
|
|
13
|
+
capping_status?: string;
|
|
14
|
+
used_quota?: number;
|
|
15
|
+
total_quota?: number;
|
|
16
|
+
}
|
|
17
|
+
export type LimitedInput = {
|
|
18
|
+
source: 'connection-update';
|
|
19
|
+
reachoutTimeLock: RawReachoutTimelock;
|
|
20
|
+
} | {
|
|
21
|
+
source: 'message-capping';
|
|
22
|
+
capInfo: RawCapInfo;
|
|
23
|
+
};
|
|
24
|
+
export interface RawPresence {
|
|
25
|
+
id: string;
|
|
26
|
+
presences: {
|
|
27
|
+
[participant: string]: {
|
|
28
|
+
lastKnownPresence?: string;
|
|
29
|
+
lastSeen?: number;
|
|
30
|
+
};
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
export type NewsletterInput = {
|
|
34
|
+
source: 'reaction';
|
|
35
|
+
payload: {
|
|
36
|
+
id: string;
|
|
37
|
+
server_id?: string;
|
|
38
|
+
reaction?: {
|
|
39
|
+
code?: string;
|
|
40
|
+
count?: number;
|
|
41
|
+
};
|
|
42
|
+
};
|
|
43
|
+
} | {
|
|
44
|
+
source: 'view';
|
|
45
|
+
payload: {
|
|
46
|
+
id: string;
|
|
47
|
+
server_id?: string;
|
|
48
|
+
count?: number;
|
|
49
|
+
};
|
|
50
|
+
} | {
|
|
51
|
+
source: 'participants';
|
|
52
|
+
payload: {
|
|
53
|
+
id: string;
|
|
54
|
+
author?: string;
|
|
55
|
+
user?: string;
|
|
56
|
+
new_role?: string;
|
|
57
|
+
action?: string;
|
|
58
|
+
};
|
|
59
|
+
} | {
|
|
60
|
+
source: 'settings';
|
|
61
|
+
payload: {
|
|
62
|
+
id: string;
|
|
63
|
+
update?: Record<string, unknown>;
|
|
64
|
+
};
|
|
65
|
+
};
|
|
66
|
+
export declare const decodeHistorySync: (item: RawHistorySync) => HistorySyncPayload | null;
|
|
67
|
+
export declare const decodeLimited: (input: LimitedInput) => LimitedPayload | null;
|
|
68
|
+
export declare const decodePresence: (item: RawPresence) => PresencePayload[];
|
|
69
|
+
export declare const decodeNewsletter: (input: NewsletterInput) => NewsletterPayload | null;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { type WAMessage, type WAMessageKey } from 'baileys';
|
|
2
|
+
import type { TextOptions } from '../../builder/builder.js';
|
|
3
|
+
import { type CitationConfig, type MentionAllContext, type MentionContext, type MessageContext } from '../context.js';
|
|
4
|
+
import { type DownloadLogger } from './_media-download.js';
|
|
5
|
+
export interface DecodeContext {
|
|
6
|
+
selfJid: string;
|
|
7
|
+
selfLid?: string;
|
|
8
|
+
selfName?: string;
|
|
9
|
+
lidMap?: Map<string, string>;
|
|
10
|
+
logger?: DownloadLogger;
|
|
11
|
+
channelId?: string;
|
|
12
|
+
receiverId?: string;
|
|
13
|
+
prefixes?: string[];
|
|
14
|
+
citationConfig?: CitationConfig;
|
|
15
|
+
resolveRoomName?: (roomId: string) => Promise<string | null>;
|
|
16
|
+
resolveReceiverName?: () => Promise<string | null>;
|
|
17
|
+
resolveQuoted?: (id: string, remoteJid: string) => Promise<WAMessage | null>;
|
|
18
|
+
reply?: (target: string, content: string, opts: TextOptions | undefined, quoted: WAMessage) => Promise<WAMessageKey>;
|
|
19
|
+
react?: (key: WAMessageKey, emoji: string) => Promise<WAMessageKey>;
|
|
20
|
+
}
|
|
21
|
+
export declare const rawMentionsOf: (msg: WAMessage) => string[];
|
|
22
|
+
export declare const decodeMessage: (msg: WAMessage, ctx: DecodeContext) => MessageContext | null;
|
|
23
|
+
export declare const decodeText: (msg: WAMessage, ctx: DecodeContext) => MessageContext | null;
|
|
24
|
+
export declare const decodeImage: (msg: WAMessage, ctx: DecodeContext) => MessageContext | null;
|
|
25
|
+
export declare const decodeVideo: (msg: WAMessage, ctx: DecodeContext) => MessageContext | null;
|
|
26
|
+
export declare const decodeAudio: (msg: WAMessage, ctx: DecodeContext) => MessageContext | null;
|
|
27
|
+
export declare const decodeDocument: (msg: WAMessage, ctx: DecodeContext) => MessageContext | null;
|
|
28
|
+
export declare const decodeSticker: (msg: WAMessage, ctx: DecodeContext) => MessageContext | null;
|
|
29
|
+
export declare const decodeMention: (msg: WAMessage, ctx: DecodeContext) => MentionContext | null;
|
|
30
|
+
export declare const decodeMentionAll: (msg: WAMessage, ctx: DecodeContext) => MentionAllContext | null;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { proto, type WAMessageKey } from 'baileys';
|
|
2
|
+
import type { DeletePayload, EditPayload, PollVotePayload, ReactionPayload } from '../types.js';
|
|
3
|
+
import { type LongLike } from './_shared.js';
|
|
4
|
+
export interface MutationContext {
|
|
5
|
+
selfJid: string;
|
|
6
|
+
pushName?: string;
|
|
7
|
+
}
|
|
8
|
+
export interface ReactionItem {
|
|
9
|
+
key: WAMessageKey;
|
|
10
|
+
reaction: proto.IReaction;
|
|
11
|
+
}
|
|
12
|
+
export interface MessageUpdate {
|
|
13
|
+
key: WAMessageKey;
|
|
14
|
+
update: {
|
|
15
|
+
message?: proto.IMessage | null;
|
|
16
|
+
messageTimestamp?: number | LongLike | null;
|
|
17
|
+
pollUpdates?: proto.IPollUpdate[] | null;
|
|
18
|
+
status?: number | null;
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
export declare const decodeReaction: (item: ReactionItem, ctx: MutationContext) => ReactionPayload | null;
|
|
22
|
+
export declare const decodeEdit: (update: MessageUpdate, ctx: MutationContext) => EditPayload | null;
|
|
23
|
+
export declare const decodeDelete: (update: MessageUpdate, ctx: MutationContext) => DeletePayload | null;
|
|
24
|
+
export declare const decodePollVote: (update: MessageUpdate, ctx: MutationContext) => PollVotePayload | null;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { WAMessage, MessageUpsertType } from 'baileys';
|
|
2
|
+
export declare const SELF_ONLY_PROTOCOL_TYPES: readonly ["HISTORY_SYNC_NOTIFICATION", "APP_STATE_SYNC_KEY_SHARE", "LID_MIGRATION_MAPPING_SYNC", "PEER_DATA_OPERATION_REQUEST_RESPONSE_MESSAGE"];
|
|
3
|
+
export type SelfOnlyProtocolType = (typeof SELF_ONLY_PROTOCOL_TYPES)[number];
|
|
4
|
+
export interface UpsertPayload {
|
|
5
|
+
messages: WAMessage[];
|
|
6
|
+
type: MessageUpsertType;
|
|
7
|
+
requestId?: string;
|
|
8
|
+
}
|
|
9
|
+
export declare const dropSpoofedSelfOnly: (upsert: UpsertPayload) => UpsertPayload;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export * from './guards.js';
|
|
2
|
+
export type { ButtonClickPayload, CallBase, CallPayload, DeletePayload, EditPayload, GroupJoinPayload, GroupLeavePayload, GroupParticipantInfo, GroupUpdatePayload, HistorySyncPayload, InboundEventMap, InboundEventName, LimitedPayload, ListSelectPayload, MediaDescriptor, MediaDownloadResult, MediaKind, MemberTagPayload, NewsletterPayload, PollVotePayload, PresencePayload, QuotedRef, ReactionPayload, SenderInfo, } from './types.js';
|
|
3
|
+
export type { BuildContextInput, ChatType, CitationConfig, CitationPredicates, ContextMedia, MentionAllContext, MentionContext, MessageContext, SenderDevice, } from './context.js';
|
|
4
|
+
export { buildMessageContext } from './context.js';
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import type { WAMessage, WAMessageKey } from 'baileys';
|
|
2
|
+
import type { CitationConfig } from './context.js';
|
|
3
|
+
import type { TextOptions } from '../builder/builder.js';
|
|
4
|
+
import type { ClientEventMap, Logger } from '../client/types.js';
|
|
5
|
+
import type { TypedEventEmitter } from '../client/event-emitter.js';
|
|
6
|
+
export interface InboundPipelineHandle {
|
|
7
|
+
detach: () => void;
|
|
8
|
+
}
|
|
9
|
+
export interface InboundPipelineContext {
|
|
10
|
+
selfJid: string;
|
|
11
|
+
selfLid?: string;
|
|
12
|
+
selfName?: string;
|
|
13
|
+
logger?: Logger;
|
|
14
|
+
channelId?: string;
|
|
15
|
+
receiverId?: string;
|
|
16
|
+
prefixes?: string[];
|
|
17
|
+
citationConfig?: CitationConfig;
|
|
18
|
+
groupMetadata?: (groupId: string) => Promise<{
|
|
19
|
+
subject?: string;
|
|
20
|
+
} | null>;
|
|
21
|
+
receiverName?: () => Promise<string | null>;
|
|
22
|
+
resolveQuoted?: (id: string, remoteJid: string) => Promise<WAMessage | null>;
|
|
23
|
+
resolveLidToPn?: (lid: string) => Promise<string | null>;
|
|
24
|
+
sendReply?: (target: string, content: string, opts: TextOptions | undefined, quoted: WAMessage) => Promise<WAMessageKey>;
|
|
25
|
+
react?: (key: WAMessageKey, emoji: string) => Promise<WAMessageKey>;
|
|
26
|
+
ignoreMe?: boolean;
|
|
27
|
+
}
|
|
28
|
+
export interface BaileysEventSurface {
|
|
29
|
+
on: (event: string, handler: (...args: unknown[]) => void) => void;
|
|
30
|
+
off: (event: string, handler: (...args: unknown[]) => void) => void;
|
|
31
|
+
}
|
|
32
|
+
export interface PipelineSocketLike {
|
|
33
|
+
ev: BaileysEventSurface;
|
|
34
|
+
}
|
|
35
|
+
type ClientEmitter = TypedEventEmitter<ClientEventMap>;
|
|
36
|
+
export declare function attachInboundPipeline(client: ClientEmitter, socket: PipelineSocketLike, ctx: InboundPipelineContext): InboundPipelineHandle;
|
|
37
|
+
export {};
|