zaileys 4.8.6 → 4.8.7
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/dist/builder/builder.d.ts +6 -0
- package/dist/builder/content/buttons.d.ts +8 -0
- package/dist/builder/content/group-status.d.ts +5 -2
- package/dist/builder/status-wrap.d.ts +11 -0
- package/dist/builder/types.d.ts +11 -2
- package/dist/client/client.d.ts +2 -0
- package/dist/index.cjs +16 -16
- package/dist/index.mjs +16 -16
- package/package.json +1 -1
|
@@ -58,6 +58,12 @@ export declare class MessageBuilder<State extends BuilderState> {
|
|
|
58
58
|
disappearing(seconds: number): MessageBuilder<State>;
|
|
59
59
|
then<T = WAMessageKey>(this: MessageBuilder<'content-set'>, onResolved: (key: WAMessageKey) => T, onRejected?: (err: unknown) => T | PromiseLike<T>): Promise<T>;
|
|
60
60
|
private uploadHeaderMedia;
|
|
61
|
+
/**
|
|
62
|
+
* Uploads the status media and returns it at the TOP level, not inside the envelope. baileys derives
|
|
63
|
+
* the stanza's `mediatype` attribute from the raw message before `patchMessageBeforeSending` runs, and
|
|
64
|
+
* the server drops a media status that lacks it — so the wrapping happens later, in that hook.
|
|
65
|
+
*/
|
|
66
|
+
private buildStatusMedia;
|
|
61
67
|
/** Relay skips baileys' contextInfo pass, so mentions and mentionAll are applied to the unwrapped node here. */
|
|
62
68
|
private applyRelayMentions;
|
|
63
69
|
private sendRelay;
|
|
@@ -4,6 +4,14 @@ export declare const RELAY_CONTENT_KEY = "__zaileysRelayMessage";
|
|
|
4
4
|
export declare const RELAY_MEDIA_KEY = "__zaileysHeaderMedia";
|
|
5
5
|
/** Marks relay content that may only target a group jid; the value is the method label used in the error. */
|
|
6
6
|
export declare const RELAY_REQUIRE_GROUP_KEY = "__zaileysRequireGroupJid";
|
|
7
|
+
/** Carries a downloaded media buffer that `sendRelay` re-uploads and injects into the status envelope. */
|
|
8
|
+
export declare const RELAY_STATUS_MEDIA_KEY = "__zaileysStatusMedia";
|
|
9
|
+
export type StatusMedia = {
|
|
10
|
+
kind: 'image' | 'video' | 'audio';
|
|
11
|
+
buffer: Buffer;
|
|
12
|
+
caption?: string;
|
|
13
|
+
ptt?: boolean;
|
|
14
|
+
};
|
|
7
15
|
export type HeaderMedia = {
|
|
8
16
|
kind: 'image' | 'video';
|
|
9
17
|
src: MediaSource;
|
|
@@ -8,5 +8,8 @@ export declare const parseStatusArgb: (value: string | number) => number;
|
|
|
8
8
|
/** Resolves a named font to its WhatsApp `FontType`; raw integers pass through for forward compatibility. */
|
|
9
9
|
export declare const resolveStatusFont: (value: GroupStatusFont | number) => number;
|
|
10
10
|
export declare const buildGroupStatusContent: (text: string, opts?: GroupStatusOptions) => AnyMessageContent;
|
|
11
|
-
/**
|
|
12
|
-
|
|
11
|
+
/**
|
|
12
|
+
* Reposts an existing message as a group status. Media cannot be carried by copying pointers — the
|
|
13
|
+
* bytes are downloaded here and re-uploaded at dispatch, because a status needs its own upload.
|
|
14
|
+
*/
|
|
15
|
+
export declare const buildGroupStatusRepost: (source: GroupStatusSource, opts?: GroupStatusRepostOptions) => Promise<AnyMessageContent>;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Marks a media message to be wrapped into a group status envelope at send time.
|
|
3
|
+
*
|
|
4
|
+
* baileys reads `getMediaType()` from the raw message to set the stanza's `mediatype` attribute, and
|
|
5
|
+
* only calls `patchMessageBeforeSending` afterwards. A media message nested inside
|
|
6
|
+
* `groupStatusMessageV2` is therefore invisible to that check and the server drops it. Relaying the
|
|
7
|
+
* media at the top level and wrapping it in the patch hook gets both the attribute and the envelope.
|
|
8
|
+
*/
|
|
9
|
+
export declare const markAsGroupStatus: (message: object) => void;
|
|
10
|
+
/** Wraps a marked message into the group status envelope; returns it untouched otherwise. */
|
|
11
|
+
export declare const applyGroupStatusWrap: <T extends object>(message: T) => T;
|
package/dist/builder/types.d.ts
CHANGED
|
@@ -163,10 +163,19 @@ export type GroupStatusOptions = {
|
|
|
163
163
|
/** Font face. Accepts a named font or a raw FontType integer for forward compatibility. */
|
|
164
164
|
font?: GroupStatusFont | number;
|
|
165
165
|
};
|
|
166
|
-
/**
|
|
166
|
+
/** Media posted directly as a group status, without an existing message to repost. */
|
|
167
|
+
export type GroupStatusMedia = {
|
|
168
|
+
image?: MediaSource;
|
|
169
|
+
video?: MediaSource;
|
|
170
|
+
audio?: MediaSource;
|
|
171
|
+
caption?: string;
|
|
172
|
+
/** Send an audio status as a voice note. */
|
|
173
|
+
ptt?: boolean;
|
|
174
|
+
};
|
|
175
|
+
/** What a group status can be built from: a `MessageContext`, a raw `WAMessage`, or fresh media. */
|
|
167
176
|
export type GroupStatusSource = WAMessage | {
|
|
168
177
|
message: () => WAMessage;
|
|
169
|
-
};
|
|
178
|
+
} | GroupStatusMedia;
|
|
170
179
|
export type GroupStatusRepostOptions = {
|
|
171
180
|
/** Replaces the original caption. Ignored for voice notes, which have none. */
|
|
172
181
|
caption?: string;
|
package/dist/client/client.d.ts
CHANGED
|
@@ -142,6 +142,8 @@ export declare class Client extends TypedEventEmitter<ClientEventMap> {
|
|
|
142
142
|
pin(key: WAMessageKey, opts?: PinOptions): Promise<WAMessageKey>;
|
|
143
143
|
unpin(key: WAMessageKey): Promise<WAMessageKey>;
|
|
144
144
|
setDisappearing(to: string, seconds: number): Promise<void>;
|
|
145
|
+
/** Group status media must be wrapped after baileys computes the stanza's mediatype; see status-wrap. */
|
|
146
|
+
private readonly patchOutgoing;
|
|
145
147
|
private resolveRecipient;
|
|
146
148
|
private requireSocket;
|
|
147
149
|
/** Messaging seam: baileys socket or the cloud transport, whichever the provider dictates. */
|