@ryuu-reinzz/haruka-lib 3.5.0 → 3.6.0

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/main/socket.js CHANGED
@@ -262,6 +262,8 @@ export default function addProperty(socket, baileys) {
262
262
  contextInfo = {},
263
263
  bottom_sheet = false,
264
264
  bottom_name = "",
265
+ limited_time_offer_text = "",
266
+ limited_time_offer = false,
265
267
  mentionedJid = []
266
268
  } = content;
267
269
 
@@ -453,17 +455,25 @@ export default function addProperty(socket, baileys) {
453
455
  messageContent.nativeFlowMessage = {
454
456
  buttons: processedButtons,
455
457
  };
458
+ const params = {};
456
459
 
457
460
  if (bottom_sheet) {
458
- messageContent.nativeFlowMessage.messageParamsJson = JSON.stringify({
459
- bottom_sheet: {
460
- in_thread_buttons_limit: 1,
461
- divider_indices: [1, 2],
462
- list_title: bottom_name,
463
- button_title: bottom_name
464
- }
465
- });
461
+ params.bottom_sheet = {
462
+ in_thread_buttons_limit: 1,
463
+ divider_indices: [1, 2],
464
+ list_title: bottom_name,
465
+ button_title: bottom_name
466
+ };
467
+ }
468
+ if (limited_time_offer) {
469
+ params.limited_time_offer = {
470
+ text: limited_time_offer_text || "",
471
+ url: '',
472
+ copy_code: '',
473
+ expiration_time: Date.now() + (1000 * 60 * 60 * 24 * 7)
474
+ };
466
475
  }
476
+ messageContent.nativeFlowMessage.messageParamsJson = JSON.stringify(params);
467
477
 
468
478
  if (contextInfo.externalAdReply && typeof contextInfo.externalAdReply === "object") {
469
479
  messageContent.contextInfo = {
@@ -378,14 +378,14 @@ class AuthDatabase {
378
378
  }
379
379
  }
380
380
 
381
- let dbInstance = null;
381
+ const instances = new Map();
382
382
 
383
- export default function getAuthDatabase(dbPath = DEFAULT_DB, options = {}) {
384
- if (!dbInstance || dbInstance.disposed) {
383
+ export default function getAuthDatabase(dbPath, options = {}) {
384
+ if (!instances.has(dbPath) || instances.get(dbPath).disposed) {
385
385
  const {
386
386
  BufferJSON
387
387
  } = options;
388
- dbInstance = new AuthDatabase(dbPath, options, BufferJSON);
388
+ instances.set(dbPath, new AuthDatabase(dbPath, options, BufferJSON));
389
389
  }
390
- return dbInstance;
390
+ return instances.get(dbPath);
391
391
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ryuu-reinzz/haruka-lib",
3
- "version": "3.5.0",
3
+ "version": "3.6.0",
4
4
  "description": "Library extra for bot WhatsApp",
5
5
  "main": "main/index.js",
6
6
  "type": "module",