@whanext/core 0.19.0 → 0.19.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/CHANGELOG.md +13 -0
- package/dist/index.js +38 -19
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,18 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.19.2
|
|
4
|
+
|
|
5
|
+
- Corrigido o download real de mídias citadas no provider Zapo: `downloadMedia()` agora entrega o `Proto.IMessage` bruto diretamente ao `downloadBytes()`, como suportado pela API do Zapo.
|
|
6
|
+
- Envelopes `viewOnceMessage`, `viewOnceMessageV2` e `viewOnceMessageV2Extension` são desembrulhados antes do download, evitando falhas ao responder imagens/vídeos de visualização única.
|
|
7
|
+
- A correção cobre replies comuns de imagem, vídeo, áudio e sticker, além de view-once.
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
## 0.19.1
|
|
11
|
+
|
|
12
|
+
- Corrige menus de lista no provider Zapo usando `interactiveMessage` Native Flow com `single_select` em vez do `listMessage` legado.
|
|
13
|
+
- Respostas de `single_select` agora são normalizadas explicitamente como `message.interactive.kind = "list"`.
|
|
14
|
+
|
|
15
|
+
|
|
3
16
|
## 0.19.0
|
|
4
17
|
|
|
5
18
|
### Comandos
|
package/dist/index.js
CHANGED
|
@@ -2596,14 +2596,19 @@ function getInteractiveResponse(content) {
|
|
|
2596
2596
|
const nativeId = stringField(native, ["id", "selected_id", "row_id", "button_id"]);
|
|
2597
2597
|
if (nativeId) {
|
|
2598
2598
|
const title = stringField(native, ["display_text", "title"]);
|
|
2599
|
+
const nativeName = nativeFlowName(content);
|
|
2599
2600
|
return {
|
|
2600
|
-
kind: native && ("row_id" in native || "selected_id" in native) ? "list" : "button",
|
|
2601
|
+
kind: nativeName === "single_select" || native && ("row_id" in native || "selected_id" in native) ? "list" : "button",
|
|
2601
2602
|
id: nativeId,
|
|
2602
2603
|
...title ? { title } : {}
|
|
2603
2604
|
};
|
|
2604
2605
|
}
|
|
2605
2606
|
return void 0;
|
|
2606
2607
|
}
|
|
2608
|
+
function nativeFlowName(content) {
|
|
2609
|
+
const response = content.interactiveResponseMessage;
|
|
2610
|
+
return response?.nativeFlowResponseMessage?.name ?? void 0;
|
|
2611
|
+
}
|
|
2607
2612
|
function getNativeFlowDisplayText(content) {
|
|
2608
2613
|
return stringField(nativeFlowParams(content), ["display_text", "title"]);
|
|
2609
2614
|
}
|
|
@@ -2854,9 +2859,8 @@ var ZapoProvider = class {
|
|
|
2854
2859
|
);
|
|
2855
2860
|
}
|
|
2856
2861
|
try {
|
|
2857
|
-
const
|
|
2858
|
-
|
|
2859
|
-
);
|
|
2862
|
+
const mediaMessage = unwrapZapoMessageContent(message.message) ?? message.message;
|
|
2863
|
+
const bytes = await this.#requireClient().message.downloadBytes(mediaMessage);
|
|
2860
2864
|
return {
|
|
2861
2865
|
data: Buffer.from(bytes),
|
|
2862
2866
|
kind: normalized.media.kind,
|
|
@@ -3299,21 +3303,36 @@ var ZapoProvider = class {
|
|
|
3299
3303
|
this.#validateList(content);
|
|
3300
3304
|
const mentions = content.mentions ? this.#mentions(content.mentions) : [];
|
|
3301
3305
|
const raw = {
|
|
3302
|
-
|
|
3303
|
-
...content.title !== void 0 ? {
|
|
3304
|
-
|
|
3305
|
-
|
|
3306
|
-
|
|
3307
|
-
|
|
3308
|
-
|
|
3309
|
-
|
|
3310
|
-
|
|
3311
|
-
|
|
3312
|
-
|
|
3313
|
-
|
|
3314
|
-
|
|
3315
|
-
|
|
3316
|
-
|
|
3306
|
+
interactiveMessage: {
|
|
3307
|
+
...content.title !== void 0 ? {
|
|
3308
|
+
header: {
|
|
3309
|
+
title: content.title,
|
|
3310
|
+
hasMediaAttachment: false
|
|
3311
|
+
}
|
|
3312
|
+
} : {},
|
|
3313
|
+
body: { text: content.text },
|
|
3314
|
+
...content.footer !== void 0 ? { footer: { text: content.footer } } : {},
|
|
3315
|
+
...mentions.length > 0 ? { contextInfo: { mentionedJid: mentions } } : {},
|
|
3316
|
+
nativeFlowMessage: {
|
|
3317
|
+
buttons: [
|
|
3318
|
+
{
|
|
3319
|
+
name: "single_select",
|
|
3320
|
+
buttonParamsJson: JSON.stringify({
|
|
3321
|
+
title: content.buttonText,
|
|
3322
|
+
sections: content.list.map((section) => ({
|
|
3323
|
+
...section.title !== void 0 ? { title: section.title } : {},
|
|
3324
|
+
rows: section.rows.map((row) => ({
|
|
3325
|
+
id: row.id,
|
|
3326
|
+
title: row.title,
|
|
3327
|
+
...row.description !== void 0 ? { description: row.description } : {}
|
|
3328
|
+
}))
|
|
3329
|
+
}))
|
|
3330
|
+
})
|
|
3331
|
+
}
|
|
3332
|
+
],
|
|
3333
|
+
messageParamsJson: "{}",
|
|
3334
|
+
messageVersion: 1
|
|
3335
|
+
}
|
|
3317
3336
|
}
|
|
3318
3337
|
};
|
|
3319
3338
|
const result = await this.#requireClient().message.send(chatId, raw, {
|