@inetafrica/open-claudia 2.6.46 → 2.6.47
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/channels/voice/adapter.js +21 -0
- package/package.json +1 -1
|
@@ -246,6 +246,27 @@ class VoiceAdapter {
|
|
|
246
246
|
let msg = {};
|
|
247
247
|
try { msg = JSON.parse(data.toString()); } catch (e) { return; }
|
|
248
248
|
if (msg.kind === "ping") return; // keepalive
|
|
249
|
+
if (msg.kind === "button" || msg.kind === "action") {
|
|
250
|
+
const payload = String(msg.payload != null ? msg.payload : (msg.id != null ? msg.id : ""));
|
|
251
|
+
if (!payload) return;
|
|
252
|
+
this._emit("action", {
|
|
253
|
+
adapter: this,
|
|
254
|
+
channelId: this.channelId,
|
|
255
|
+
canonicalUserId: canonicalForChannel("voice", this.channelId),
|
|
256
|
+
userId: this.ownerUserId,
|
|
257
|
+
type: "action",
|
|
258
|
+
messageId: msg.messageId,
|
|
259
|
+
from: { id: this.ownerUserId, name: "Owner", username: "" },
|
|
260
|
+
action: {
|
|
261
|
+
buttonId: String(msg.id != null ? msg.id : payload),
|
|
262
|
+
payload,
|
|
263
|
+
sourceMessageId: msg.messageId,
|
|
264
|
+
callbackId: this._mkId("cb"),
|
|
265
|
+
},
|
|
266
|
+
raw: msg,
|
|
267
|
+
});
|
|
268
|
+
return;
|
|
269
|
+
}
|
|
249
270
|
if (msg.kind === "text" && (msg.text || "").trim()) {
|
|
250
271
|
const text = String(msg.text);
|
|
251
272
|
const messageId = this._mkId("t");
|
package/package.json
CHANGED