puvox-library 1.0.16 → 1.0.18

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.
@@ -2476,8 +2476,8 @@ const puvox_library =
2476
2476
 
2477
2477
  // region ### TELEGRAM FUNCTIONS ###
2478
2478
  async telegramMessage(text, chat_id, bot_key, extra_opts={}){
2479
+ if (!extra_opts) extra_opts = {};
2479
2480
  const is_repeated_call = 'is_repeated_call' in extra_opts;
2480
- const use_cache = 'cache' in extra_opts;
2481
2481
  if (! ('parse_mode' in extra_opts)){
2482
2482
  extra_opts['parse_mode'] = 'html';
2483
2483
  }
@@ -2520,14 +2520,15 @@ const puvox_library =
2520
2520
  telegram_interval_ms: 50, // telegram seems to accept around 30 times per second, so we'd better wait around that milliseconds
2521
2521
  telegram_last_sent_time: 0,
2522
2522
 
2523
- async telegramMessageCached(text, chat_id, bot_key, extra_opts={}){
2523
+ async telegramMessageCached(text, chat_id, bot_key, extra_opts={}, customCacheId=null){
2524
+ if (!extra_opts) extra_opts = {};
2524
2525
  const curMS = this.milliseconds();
2525
2526
  const goneMS = curMS - this.telegram_last_sent_time;
2526
2527
  if ( goneMS < this.telegram_interval_ms ){
2527
2528
  await this.sleep (this.telegram_interval_ms - goneMS);
2528
2529
  }
2529
2530
  this.telegram_last_sent_time = curMS;
2530
- const cacheId = this.cache.file.idForContent( text +'_'+ chat_id +'_'+ bot_key +'_'+ JSON.stringify(extra_opts) );
2531
+ const cacheId = customCacheId ? customCacheId : this.cache.file.idForContent( text +'_'+ chat_id +'_'+ bot_key +'_'+ JSON.stringify(extra_opts) );
2531
2532
  if (this.cache.file.addIdIfNotExists('function_telegram_message', cacheId) ){
2532
2533
  return this.telegramMessage(text, chat_id, bot_key, extra_opts);
2533
2534
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "puvox-library",
3
- "version": "1.0.16",
3
+ "version": "1.0.18",
4
4
  "description": "library-class-javascript",
5
5
  "main": "library_standard.js",
6
6
  "scripts": {