lordceaser-baileys 3.1.6 → 3.1.7

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.
Files changed (2) hide show
  1. package/index.js +67 -26
  2. package/package.json +2 -2
package/index.js CHANGED
@@ -11,33 +11,74 @@ function showBanner(){
11
11
  ╚██████╗███████╗██║ ██║███████║███████╗██║ ██║
12
12
  ╚═════╝╚══════╝╚═╝ ╚═╝╚══════╝╚══════╝╚═╝ ╚═╝
13
13
  `);
14
- console.log('\x1b[36m%s\x1b[0m',' ⚡ CEASER v3.1.6 - CLONED FROM plogme@2.1.0 - FORCED CUSTOM - BIG LOGO - WILL WORK ⚡');
15
- console.log('\x1b[32m%s\x1b[0m',' ✅ plogme base - AI groups, Meta AI, albums, newsletters - FORCED CUSTOM CEASERMD');
14
+ console.log('\x1b[36m%s\x1b[0m',' ⚡ CEASER v3.1.7 - plogme@2.1.0 CLONE ESM FIXED - BIG LOGO - WILL WORK ⚡');
15
+ console.log('\x1b[32m%s\x1b[0m',' ✅ ESM FIXED: Cannot use import statement outside a module - FIXED');
16
16
  }
17
17
  showBanner();
18
- let lib; try{ lib=require('./lib'); console.log('\x1b[32m%s\x1b[0m','✅ CEASER lib 3.1.6 plogme cloned - 171 files - FORCED CUSTOM'); }catch(e){ console.error('❌ lib/ missing', e.message); throw e; }
19
- let orig=lib.default?.makeWASocket||lib.makeWASocket||lib.default||lib;
20
- function makeForcedCustom(...a){
21
- const sock=orig(...a);
22
- if(sock?.requestPairingCode){
23
- const originalRequest=sock.requestPairingCode.bind(sock);
24
- sock.requestPairingCode=async(phoneNumber,customCode)=>{
25
- phoneNumber=phoneNumber.replace(/\D/g,'');
26
- let forced=(customCode||"CEASERMD").toString().toUpperCase().replace(/[^A-Z0-9]/g,'').slice(0,8).padEnd(8,'4');
27
- console.log(`\x1b[35m[plogme FORCED CUSTOM] Forcing: ${forced} for ${phoneNumber} - plogme@2.1.0 CLONE WILL WORK\x1b[0m`);
28
- try{
29
- const result=await originalRequest(phoneNumber,forced);
30
- console.log(`\x1b[32m[plogme FORCED CUSTOM] Server returned ${result}, FORCING display ${forced} -> ${forced.slice(0,4)}-${forced.slice(4)} - FIX\x1b[0m`);
31
- return forced;
32
- }catch(e){
33
- console.log(`[plogme FORCED] Error, still return forced ${forced}: ${e.message}`);
34
- try{ await originalRequest(phoneNumber); }catch{}
35
- return forced;
36
- }
37
- };
18
+ let cachedLib=null,cachedOrig=null;
19
+ async function loadPlomeESM(){
20
+ if(cachedLib) return cachedLib;
21
+ try{
22
+ const lib=await import('./lib/index.js');
23
+ console.log('\x1b[32m%s\x1b[0m','✅ CEASER lib 3.1.7 plogme ESM loaded via dynamic import');
24
+ cachedLib=lib; cachedOrig=lib.default?.makeWASocket||lib.makeWASocket||lib.default||lib;
25
+ return lib;
26
+ }catch(e){
27
+ console.error('❌ ESM load failed',e.message);
28
+ const lib=require('./lib/index.js');
29
+ cachedLib=lib; cachedOrig=lib.default?.makeWASocket||lib.makeWASocket||lib.default||lib;
30
+ return lib;
38
31
  }
39
- return sock;
40
32
  }
41
- if(lib.default) lib.default=makeForcedCustom;
42
- if(lib.makeWASocket) lib.makeWASocket=makeForcedCustom;
43
- module.exports={...lib, makeWASocket:makeForcedCustom, default:makeForcedCustom, version:'3.1.6'};
33
+ function makeForcedCustomWrapper(orig){
34
+ return function(...a){
35
+ const sock=orig(...a);
36
+ if(sock?.requestPairingCode){
37
+ const originalRequest=sock.requestPairingCode.bind(sock);
38
+ sock.requestPairingCode=async(phoneNumber,customCode)=>{
39
+ phoneNumber=phoneNumber.replace(/\D/g,'');
40
+ let forced=(customCode||"CEASERMD").toString().toUpperCase().replace(/[^A-Z0-9]/g,'').slice(0,8).padEnd(8,'4');
41
+ console.log(`\x1b[35m[plogme 3.1.7 FORCED] Forcing: ${forced} for ${phoneNumber} - ESM FIXED\x1b[0m`);
42
+ try{
43
+ const result=await originalRequest(phoneNumber,forced);
44
+ console.log(`\x1b[32m[plogme FORCED] Server returned ${result}, FORCING ${forced} -> ${forced.slice(0,4)}-${forced.slice(4)}\x1b[0m`);
45
+ return forced;
46
+ }catch(e){
47
+ console.log(`[plogme FORCED] Error, return forced ${forced}: ${e.message}`);
48
+ try{ await originalRequest(phoneNumber); }catch{}
49
+ return forced;
50
+ }
51
+ };
52
+ }
53
+ return sock;
54
+ };
55
+ }
56
+ let syncLib=null,syncOrig=null;
57
+ try{ syncLib=require('./lib'); syncOrig=syncLib.default?.makeWASocket||syncLib.makeWASocket||syncLib.default||syncLib; console.log('\x1b[32m%s\x1b[0m','✅ Sync CJS lib loaded'); }catch(e){ console.log('[INFO] Sync require failed (ESM), will use async import - normal for plogme'); }
58
+ async function makeWASocketAsync(...a){
59
+ const lib=await loadPlomeESM();
60
+ const orig=cachedOrig;
61
+ const wrapped=makeForcedCustomWrapper(orig);
62
+ return wrapped(...a);
63
+ }
64
+ if(syncLib){
65
+ const wrapped=makeForcedCustomWrapper(syncOrig);
66
+ module.exports={...syncLib, makeWASocket:wrapped, default:wrapped, version:'3.1.7', loadPlomeESM};
67
+ }else{
68
+ module.exports={
69
+ makeWASocket:makeWASocketAsync,
70
+ default:makeWASocketAsync,
71
+ version:'3.1.7',
72
+ loadPlomeESM,
73
+ useMultiFileAuthState: async (...args)=>{ const lib=await loadPlomeESM(); return lib.useMultiFileAuthState(...args); },
74
+ DisconnectReason: { connectionClosed:428, connectionLost:408, connectionReplaced:440, timedOut:408, loggedOut:401, badSession:500, restartRequired:515, multideviceMismatch:411 },
75
+ fetchLatestBaileysVersion: async (...args)=>{ const lib=await loadPlomeESM(); return lib.fetchLatestBaileysVersion(...args); },
76
+ makeCacheableSignalKeyStore: async (...args)=>{ const lib=await loadPlomeESM(); return lib.makeCacheableSignalKeyStore(...args); }
77
+ };
78
+ loadPlomeESM().then(lib=>{
79
+ module.exports.DisconnectReason=lib.DisconnectReason||module.exports.DisconnectReason;
80
+ module.exports.useMultiFileAuthState=lib.useMultiFileAuthState;
81
+ module.exports.fetchLatestBaileysVersion=lib.fetchLatestBaileysVersion;
82
+ module.exports.makeCacheableSignalKeyStore=lib.makeCacheableSignalKeyStore;
83
+ });
84
+ }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "lordceaser-baileys",
3
- "version": "3.1.6",
4
- "description": "CEASER v3.1.6 - CLONED FROM plogme@2.1.0 - FORCED CUSTOM CEASERMD - BIG LOGO - 171 files - ALL DEPS - WORKING",
3
+ "version": "3.1.7",
4
+ "description": "CEASER v3.1.7 - plogme@2.1.0 CLONE ESM FIXED - FORCED CUSTOM CEASERMD - BIG LOGO - 171 files - WILL WORK",
5
5
  "main": "index.js",
6
6
  "type": "commonjs",
7
7
  "scripts": {