Advertisement
DigitalCliques

wrapModuleFunction(getPhoneNumber

May 15th, 2025
456
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
TypeScript 1.31 KB | Source Code | 0 0
  1. wrapModuleFunction(getPhoneNumber, (func, ...args) => {
  2.     const [wid] = args;
  3.    
  4.     if (wid && wid.toString().includes('lid')) {
  5.      
  6.       try {
  7.      
  8.         const { ApiContact } = require('../whatsapp/misc');
  9.        
  10.         if (ApiContact && typeof ApiContact.getPhoneNumber === 'function') {
  11.          
  12.           try {
  13.             const phoneWid = ApiContact.getPhoneNumber(wid);
  14.            
  15.  
  16.             if (phoneWid && phoneWid !== wid) {
  17.              
  18.               return phoneWid;
  19.             } else {
  20.              
  21.             }
  22.           } catch (phoneError) {
  23.            
  24.           }
  25.         }
  26.  
  27.         const { functions } = require('../whatsapp');
  28.        
  29.         if (functions && typeof functions.getPnForLid === 'function') {
  30.          
  31.           try {
  32.             const contact = { id: wid };
  33.             const pnForLid = functions.getPnForLid(contact);
  34.            
  35.             if (pnForLid) {
  36.              
  37.               return pnForLid;
  38.             } else {
  39.              
  40.             }
  41.           } catch (pnError) {
  42.            
  43.           }
  44.         }
  45.       } catch (error) {
  46.        
  47.       }
  48.  
  49.       return wid;
  50.     }
  51.  
  52.     try {
  53.       const result = func(...args);
  54.      
  55.       return result;
  56.     } catch (funcError) {
  57.      
  58.       return wid;
  59.     }
  60.   });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement