feat: extend BlueBubbles attachment handling by adding support for reply context, allowing users to reference previous messages in media attachments
This commit is contained in:
committed by
Peter Steinberger
parent
7bc3998451
commit
95f82154f7
@@ -111,9 +111,12 @@ export async function sendBlueBubblesAttachment(params: {
|
|||||||
filename: string;
|
filename: string;
|
||||||
contentType?: string;
|
contentType?: string;
|
||||||
caption?: string;
|
caption?: string;
|
||||||
|
replyToMessageGuid?: string;
|
||||||
|
replyToPartIndex?: number;
|
||||||
opts?: BlueBubblesAttachmentOpts;
|
opts?: BlueBubblesAttachmentOpts;
|
||||||
}): Promise<SendBlueBubblesAttachmentResult> {
|
}): Promise<SendBlueBubblesAttachmentResult> {
|
||||||
const { to, buffer, filename, contentType, caption, opts = {} } = params;
|
const { to, buffer, filename, contentType, caption, replyToMessageGuid, replyToPartIndex, opts = {} } =
|
||||||
|
params;
|
||||||
const { baseUrl, password } = resolveAccount(opts);
|
const { baseUrl, password } = resolveAccount(opts);
|
||||||
|
|
||||||
const target = resolveSendTarget(to);
|
const target = resolveSendTarget(to);
|
||||||
@@ -167,6 +170,15 @@ export async function sendBlueBubblesAttachment(params: {
|
|||||||
addField("tempGuid", `temp-${Date.now()}-${crypto.randomUUID().slice(0, 8)}`);
|
addField("tempGuid", `temp-${Date.now()}-${crypto.randomUUID().slice(0, 8)}`);
|
||||||
addField("method", "private-api");
|
addField("method", "private-api");
|
||||||
|
|
||||||
|
const trimmedReplyTo = replyToMessageGuid?.trim();
|
||||||
|
if (trimmedReplyTo) {
|
||||||
|
addField("selectedMessageGuid", trimmedReplyTo);
|
||||||
|
addField(
|
||||||
|
"partIndex",
|
||||||
|
typeof replyToPartIndex === "number" ? String(replyToPartIndex) : "0",
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
// Add optional caption
|
// Add optional caption
|
||||||
if (caption) {
|
if (caption) {
|
||||||
addField("message", caption);
|
addField("message", caption);
|
||||||
|
|||||||
@@ -139,6 +139,7 @@ export async function sendBlueBubblesMedia(params: {
|
|||||||
buffer,
|
buffer,
|
||||||
filename: resolvedFilename ?? "attachment",
|
filename: resolvedFilename ?? "attachment",
|
||||||
contentType: resolvedContentType ?? undefined,
|
contentType: resolvedContentType ?? undefined,
|
||||||
|
replyToMessageGuid: replyToId?.trim() || undefined,
|
||||||
opts: {
|
opts: {
|
||||||
cfg,
|
cfg,
|
||||||
accountId,
|
accountId,
|
||||||
|
|||||||
Reference in New Issue
Block a user