zaileys 4.8.4 → 4.8.6
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 -1
- package/dist/builder/content/buttons.d.ts +2 -0
- package/dist/builder/content/group-status.d.ts +12 -0
- package/dist/builder/types.d.ts +17 -1
- package/dist/client/types.d.ts +3 -0
- package/dist/events/context.d.ts +1 -0
- package/dist/events/decoders/_shared.d.ts +7 -0
- package/dist/index.cjs +17 -17
- package/dist/index.mjs +17 -17
- package/dist/media/ffmpeg/sticker.d.ts +7 -0
- package/package.json +8 -5
|
@@ -3,7 +3,7 @@ import { type ButtonsContentOptions } from './content/buttons.js';
|
|
|
3
3
|
import { type CarouselCard } from './content/carousel.js';
|
|
4
4
|
import { type AIRichOptions } from './content/airich.js';
|
|
5
5
|
import { type BuilderInternalState } from './state.js';
|
|
6
|
-
import type { AlbumItem, AudioOptions, BuilderState, ButtonDef, DocumentOptions, EventOptions, GroupInviteOptions, ImageOptions, InteractiveButton, ListOptions, LocationOptions, MediaSource, PollOptions, ProductOptions, StickerOptions, TemplateOptions, VideoNoteOptions, VideoOptions } from './types.js';
|
|
6
|
+
import type { AlbumItem, AudioOptions, BuilderState, ButtonDef, DocumentOptions, EventOptions, GroupInviteOptions, GroupStatusOptions, GroupStatusRepostOptions, GroupStatusSource, ImageOptions, InteractiveButton, ListOptions, LocationOptions, MediaSource, PollOptions, ProductOptions, StickerOptions, TemplateOptions, VideoNoteOptions, VideoOptions } from './types.js';
|
|
7
7
|
export interface BuilderSocketLike {
|
|
8
8
|
sendMessage(jid: string, content: AnyMessageContent, options?: MiscMessageGenerationOptions): Promise<WAMessage | undefined>;
|
|
9
9
|
relayMessage?(jid: string, message: unknown, options: {
|
|
@@ -44,6 +44,9 @@ export declare class MessageBuilder<State extends BuilderState> {
|
|
|
44
44
|
template(this: MessageBuilder<'init'>, opts: TemplateOptions): MessageBuilder<'content-set'>;
|
|
45
45
|
event(this: MessageBuilder<'init'>, opts: EventOptions): MessageBuilder<'content-set'>;
|
|
46
46
|
groupInvite(this: MessageBuilder<'init'>, opts: GroupInviteOptions): MessageBuilder<'content-set'>;
|
|
47
|
+
/** Post a group status. Pass text, or an existing message to repost it without re-uploading its media. */
|
|
48
|
+
groupStatus(this: MessageBuilder<'init'>, text: string, opts?: GroupStatusOptions): MessageBuilder<'content-set'>;
|
|
49
|
+
groupStatus(this: MessageBuilder<'init'>, source: GroupStatusSource, opts?: GroupStatusRepostOptions): MessageBuilder<'content-set'>;
|
|
47
50
|
product(this: MessageBuilder<'init'>, opts: ProductOptions): MessageBuilder<'content-set'>;
|
|
48
51
|
requestPhoneNumber(this: MessageBuilder<'init'>): MessageBuilder<'content-set'>;
|
|
49
52
|
sharePhoneNumber(this: MessageBuilder<'init'>): MessageBuilder<'content-set'>;
|
|
@@ -55,5 +58,7 @@ export declare class MessageBuilder<State extends BuilderState> {
|
|
|
55
58
|
disappearing(seconds: number): MessageBuilder<State>;
|
|
56
59
|
then<T = WAMessageKey>(this: MessageBuilder<'content-set'>, onResolved: (key: WAMessageKey) => T, onRejected?: (err: unknown) => T | PromiseLike<T>): Promise<T>;
|
|
57
60
|
private uploadHeaderMedia;
|
|
61
|
+
/** Relay skips baileys' contextInfo pass, so mentions and mentionAll are applied to the unwrapped node here. */
|
|
62
|
+
private applyRelayMentions;
|
|
58
63
|
private sendRelay;
|
|
59
64
|
}
|
|
@@ -2,6 +2,8 @@ import { proto, type AnyMessageContent } from 'baileys';
|
|
|
2
2
|
import type { BottomSheetOptions, ButtonDef, InteractiveButton, LimitedTimeOfferOptions, MediaSource } from '../types.js';
|
|
3
3
|
export declare const RELAY_CONTENT_KEY = "__zaileysRelayMessage";
|
|
4
4
|
export declare const RELAY_MEDIA_KEY = "__zaileysHeaderMedia";
|
|
5
|
+
/** Marks relay content that may only target a group jid; the value is the method label used in the error. */
|
|
6
|
+
export declare const RELAY_REQUIRE_GROUP_KEY = "__zaileysRequireGroupJid";
|
|
5
7
|
export type HeaderMedia = {
|
|
6
8
|
kind: 'image' | 'video';
|
|
7
9
|
src: MediaSource;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { type AnyMessageContent } from 'baileys';
|
|
2
|
+
import type { GroupStatusFont, GroupStatusOptions, GroupStatusRepostOptions, GroupStatusSource } from '../types.js';
|
|
3
|
+
/**
|
|
4
|
+
* Parses a group status background into an ARGB integer. Unlike baileys' `assertColor` this keeps
|
|
5
|
+
* numeric input (which that helper silently turns into `undefined`) and reads `#RGB` as CSS shorthand.
|
|
6
|
+
*/
|
|
7
|
+
export declare const parseStatusArgb: (value: string | number) => number;
|
|
8
|
+
/** Resolves a named font to its WhatsApp `FontType`; raw integers pass through for forward compatibility. */
|
|
9
|
+
export declare const resolveStatusFont: (value: GroupStatusFont | number) => number;
|
|
10
|
+
export declare const buildGroupStatusContent: (text: string, opts?: GroupStatusOptions) => AnyMessageContent;
|
|
11
|
+
/** Reposts an existing text message as a group status. Media sources are rejected — see `MEDIA_KEYS`. */
|
|
12
|
+
export declare const buildGroupStatusRepost: (source: GroupStatusSource, opts?: GroupStatusRepostOptions) => AnyMessageContent;
|
package/dist/builder/types.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { WAMessage, WAMessageKey } from 'baileys';
|
|
2
|
+
import type { StickerMetadataType } from '../media/ffmpeg/sticker.js';
|
|
2
3
|
export type BuilderState = 'init' | 'content-set';
|
|
3
4
|
export type MediaSource = string | Buffer | URL;
|
|
4
5
|
export type ImageOptions = {
|
|
@@ -24,7 +25,7 @@ export type DocumentOptions = {
|
|
|
24
25
|
mimetype?: string;
|
|
25
26
|
caption?: string;
|
|
26
27
|
};
|
|
27
|
-
export type StickerOptions = {
|
|
28
|
+
export type StickerOptions = StickerMetadataType & {
|
|
28
29
|
animated?: boolean;
|
|
29
30
|
};
|
|
30
31
|
export type AlbumItem = {
|
|
@@ -155,6 +156,21 @@ export type GroupInviteOptions = {
|
|
|
155
156
|
/** Optional JPEG thumbnail (group avatar) — improves how the card renders. */
|
|
156
157
|
thumbnail?: Buffer;
|
|
157
158
|
};
|
|
159
|
+
export type GroupStatusFont = 'system' | 'system-text' | 'fb-script' | 'system-bold' | 'morningbreeze' | 'calistoga' | 'exo2' | 'courierprime';
|
|
160
|
+
export type GroupStatusOptions = {
|
|
161
|
+
/** Background as `#RGB`, `#RRGGBB`, `#AARRGGBB` (with or without `#`), or a raw ARGB integer. */
|
|
162
|
+
backgroundColor?: string | number;
|
|
163
|
+
/** Font face. Accepts a named font or a raw FontType integer for forward compatibility. */
|
|
164
|
+
font?: GroupStatusFont | number;
|
|
165
|
+
};
|
|
166
|
+
/** A message to repost as a group status — a `MessageContext` or a raw `WAMessage`. */
|
|
167
|
+
export type GroupStatusSource = WAMessage | {
|
|
168
|
+
message: () => WAMessage;
|
|
169
|
+
};
|
|
170
|
+
export type GroupStatusRepostOptions = {
|
|
171
|
+
/** Replaces the original caption. Ignored for voice notes, which have none. */
|
|
172
|
+
caption?: string;
|
|
173
|
+
};
|
|
158
174
|
export type BuilderContext = {
|
|
159
175
|
recipient: string;
|
|
160
176
|
quoted?: WAMessage | WAMessageKey;
|
package/dist/client/types.d.ts
CHANGED
|
@@ -11,6 +11,7 @@ import type { InboundEventMap } from '../events/types.js';
|
|
|
11
11
|
import type { MessageStore } from '../store/types.js';
|
|
12
12
|
import type { PluginsOptions } from '../plugin/types.js';
|
|
13
13
|
import type { CloudOptions } from '../cloud/types.js';
|
|
14
|
+
import type { StickerMetadataType } from '../media/ffmpeg/sticker.js';
|
|
14
15
|
import type { CloudFlowResponseEvent, CloudOrderEvent, CloudStatusEvent, CloudTemplateStatusEvent } from '../cloud/translate/inbound.js';
|
|
15
16
|
export type ProviderKind = 'baileys' | 'cloud';
|
|
16
17
|
export type ConnectionState = 'idle' | 'connecting' | 'qr-pending' | 'pairing-pending' | 'connected' | 'reconnecting' | 'disconnecting' | 'disconnected';
|
|
@@ -65,6 +66,8 @@ export interface ClientOptions {
|
|
|
65
66
|
autoDelete?: AutoDeleteOptions | false;
|
|
66
67
|
/** Load and manage plugins from a directory. */
|
|
67
68
|
plugins?: PluginsOptions;
|
|
69
|
+
/** Global default sticker metadata configuration (pack name, author, etc). */
|
|
70
|
+
sticker?: StickerMetadataType;
|
|
68
71
|
}
|
|
69
72
|
export type ConnectionEventMap = {
|
|
70
73
|
connect: {
|
package/dist/events/context.d.ts
CHANGED
|
@@ -182,6 +182,7 @@ export interface MessageContext {
|
|
|
182
182
|
isHideTags: boolean;
|
|
183
183
|
isStatusMention: boolean;
|
|
184
184
|
isGroupStatusMention: boolean;
|
|
185
|
+
isGroupStatus: boolean;
|
|
185
186
|
isStory: boolean;
|
|
186
187
|
roomName(): Promise<string | null>;
|
|
187
188
|
receiverName(): Promise<string | null>;
|
|
@@ -24,3 +24,10 @@ export declare const extractMentions: (contextInfo: WAContextInfo | null | undef
|
|
|
24
24
|
export declare const mapAddressing: (key: WAMessageKey) => AddressingAliases;
|
|
25
25
|
export declare const isGroupJid: (jid: string) => boolean;
|
|
26
26
|
export declare const safeNumber: (n: number | LongLike | null | undefined) => number | null;
|
|
27
|
+
export declare const asRecord: (value: unknown) => Record<string, unknown> | null;
|
|
28
|
+
/** Order matters: unwrap() breaks on the first match, so new entries go at the end. */
|
|
29
|
+
export declare const WRAPPER_FIELDS: readonly ['ephemeralMessage', 'viewOnceMessage', 'viewOnceMessageV2', 'viewOnceMessageV2Extension', 'documentWithCaptionMessage', 'editedMessage', 'lottieStickerMessage', 'groupStatusMessage', 'groupStatusMessageV2'];
|
|
30
|
+
export declare const GROUP_STATUS_FIELDS: readonly ['groupStatusMessage', 'groupStatusMessageV2'];
|
|
31
|
+
/** True when any level of the bounded wrapper chain carries one of the given fields. */
|
|
32
|
+
export declare const wrapperChainHas: (content: Record<string, unknown>, fields: readonly string[]) => boolean;
|
|
33
|
+
export declare const unwrap: (content: Record<string, unknown>) => Record<string, unknown>;
|