@deathnaitsa/wa-api 2.1.0 → 2.1.1
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/dist/WhatsAppClient.cjs +1 -1
- package/dist/WhatsAppClient.js +1 -1
- package/dist/auth/sqliteAuthState.cjs +1 -1
- package/dist/auth/sqliteAuthState.js +1 -1
- package/dist/config-helper.cjs +71 -1
- package/dist/config-helper.js +65 -1
- package/dist/index.cjs +1 -1
- package/dist/index.js +1 -1
- package/dist/wa-api.config.cjs +197 -1
- package/dist/wa-api.config.js +197 -1
- package/package.json +1 -1
- package/CONFIG.md +0 -350
package/dist/wa-api.config.js
CHANGED
|
@@ -1 +1,197 @@
|
|
|
1
|
-
(function(_0x4c8c49,_0x32e9a9){const _0x17540e={_0x5e7d15:0x7c,_0x34c80b:0x83,_0x5782e7:0x66,_0x2ef7f7:0x2d,_0x15a4e2:0x39,_0x4827d4:0x3c,_0x297506:0x3f,_0xab769e:0x5c,_0x11df59:0x75,_0xf9369e:0x4b,_0x556e9a:0x35,_0x122e5c:0x3a,_0x3ed152:0x1d,_0x5eedcc:0x2bb,_0x1e4568:0x28a,_0x4be331:0x2a0,_0x10739b:0x69,_0x82c5cb:0x72,_0x2301d4:0x78,_0x23b59f:0x5d,_0xe67b1a:0x4e,_0x1a9cd8:0x276,_0x4c79c2:0x27e},_0x3c0886={_0xd65d9d:0xcc},_0x3bb8c1=_0x4c8c49();function _0x53c802(_0x49861d,_0xa75915,_0x4bc7ff,_0x19e5b3){return _0x28c3(_0x4bc7ff- -0x22e,_0x49861d);}function _0x22aeb9(_0x451371,_0xcc10f4,_0x52d8ad,_0x581ac0){return _0x28c3(_0x581ac0-_0x3c0886._0xd65d9d,_0x451371);}while(!![]){try{const _0x138f8f=-parseInt(_0x53c802(-0x7e,-0x7c,-0x72,-_0x17540e._0x5e7d15))/(0xb17*-0x1+0x238a+-0x1*0x1872)*(parseInt(_0x53c802(-_0x17540e._0x34c80b,-0x88,-_0x17540e._0x5782e7,-0x4c))/(-0x1517+0x2612+-0x10f9))+-parseInt(_0x53c802(-_0x17540e._0x2ef7f7,-0x64,-0x42,-0x34))/(0x1bb2+0x89b+0xa*-0x3a1)+-parseInt(_0x53c802(-_0x17540e._0x15a4e2,-_0x17540e._0x4827d4,-0x3d,-0x1e))/(0x2548+0x62f+-0x2b73)+parseInt(_0x53c802(-0x76,-_0x17540e._0x297506,-_0x17540e._0xab769e,-_0x17540e._0x11df59))/(0x1a5f+-0x1607*0x1+0x1*-0x453)*(parseInt(_0x53c802(-_0x17540e._0xf9369e,-_0x17540e._0x556e9a,-_0x17540e._0x122e5c,-_0x17540e._0x3ed152))/(-0xa08+-0xc33+0x1641))+-parseInt(_0x22aeb9(0x2c1,_0x17540e._0x5eedcc,_0x17540e._0x1e4568,_0x17540e._0x4be331))/(-0xa22+-0x23dc+-0x9*-0x51d)+parseInt(_0x53c802(-_0x17540e._0x10739b,-_0x17540e._0x82c5cb,-_0x17540e._0x2301d4,-0x7c))/(-0x2622+0x4ba+0x2170)+-parseInt(_0x53c802(-0x65,-_0x17540e._0x23b59f,-_0x17540e._0xe67b1a,-0x70))/(0xcf0+-0xa59+0x2*-0x147)*(-parseInt(_0x22aeb9(_0x17540e._0x1a9cd8,0x28c,_0x17540e._0x4c79c2,0x289))/(0xfd1+-0x2b*0x13+0x12*-0xb3));if(_0x138f8f===_0x32e9a9)break;else _0x3bb8c1['push'](_0x3bb8c1['shift']());}catch(_0x29a454){_0x3bb8c1['push'](_0x3bb8c1['shift']());}}}(_0x13b5,-0x141f0c+0x19bb4*0x5+0x19c595));const _0x2a8adb=(function(){let _0x1e597d=!![];return function(_0x3d42e1,_0x471f74){const _0x255f87={_0x5f1200:0x2f9,_0x199b5d:0x2d2,_0x42844b:0x2e5},_0x3afdc4=_0x1e597d?function(){const _0x77d8ba={_0x2b9f51:0x127};function _0x53c42f(_0x2cabe6,_0x3e2b91,_0x57cf1b,_0x4dd85c){return _0x28c3(_0x4dd85c-_0x77d8ba._0x2b9f51,_0x3e2b91);}if(_0x471f74){const _0x1c59a4=_0x471f74[_0x53c42f(_0x255f87._0x5f1200,_0x255f87._0x199b5d,0x2d6,_0x255f87._0x42844b)](_0x3d42e1,arguments);return _0x471f74=null,_0x1c59a4;}}:function(){};return _0x1e597d=![],_0x3afdc4;};}()),_0x63fc59=_0x2a8adb(this,function(){const _0x5c9a2d={_0x2e0831:0xff,_0x3abd83:0x388,_0x2fc1b1:0x378,_0x4aa868:0x3a4,_0x4c00cf:0x38d,_0x136208:0x384},_0x1a412d={_0x5e7b91:0x10d},_0x5e8dc9={_0xcfbee9:0x1b8},_0x13ac02={};function _0x5bb6ce(_0x26d878,_0x3b6c6d,_0x23bda1,_0x2af070){return _0x28c3(_0x23bda1-_0x5e8dc9._0xcfbee9,_0x2af070);}_0x13ac02['tVQTC']=_0x15d72f(0xd6,0xea,0xfc,_0x5c9a2d._0x2e0831)+'+$';const _0x43b521=_0x13ac02;function _0x15d72f(_0xa00239,_0x1bbf92,_0x445e91,_0x546383){return _0x28c3(_0x1bbf92- -_0x1a412d._0x5e7b91,_0xa00239);}return _0x63fc59[_0x5bb6ce(_0x5c9a2d._0x3abd83,_0x5c9a2d._0x2fc1b1,0x386,0x3a1)]()[_0x5bb6ce(_0x5c9a2d._0x4aa868,_0x5c9a2d._0x4c00cf,_0x5c9a2d._0x136208,0x369)](_0x43b521['tVQTC'])['toString']()['constructo'+'r'](_0x63fc59)[_0x5bb6ce(0x3a7,0x374,0x384,0x390)]('(((.+)+)+)'+'+$');});_0x63fc59();const _0x462f2c={};_0x462f2c[_0xf6877(-0x10d,-0x13c,-0x120,-0x131)+_0x6d8a8(0x1f9,0x235,0x216,0x20b)]=![],_0x462f2c['browser']=[_0xf6877(-0x15c,-0x169,-0x14f,-0x14c),_0x6d8a8(0x22a,0x213,0x235,0x22e),_0x6d8a8(0x211,0x1e1,0x204,0x208)],_0x462f2c[_0xf6877(-0x15a,-0x14a,-0x14a,-0x163)]=!![],_0x462f2c[_0x6d8a8(0x242,0x229,0x226,0x219)+_0x6d8a8(0x1ed,0x21b,0x1fb,0x211)]=_0xf6877(-0x149,-0x128,-0x14b,-0x145),_0x462f2c[_0x6d8a8(0x221,0x20d,0x21c,0x1fe)+_0xf6877(-0x121,-0xff,-0x114,-0x10d)]=![],_0x462f2c[_0x6d8a8(0x20c,0x21e,0x20b,0x1f5)]='silent',_0x462f2c['markOnline'+_0xf6877(-0x13f,-0x135,-0x149,-0x135)]=![];const _0x25fe0a={};_0x25fe0a[_0x6d8a8(0x1f9,0x201,0x212,0x234)]=0x5,_0x25fe0a[_0x6d8a8(0x215,0x206,0x1f3,0x20b)+'ay']=0x7d0,_0x25fe0a['maxDelay']=0x7530,_0x25fe0a['multiplier']=0x2;const _0x40b66d={};_0x40b66d[_0x6d8a8(0x244,0x257,0x234,0x24a)]=![],_0x40b66d['text']=_0xf6877(-0x11b,-0x10b,-0x12c,-0x13d)+_0x6d8a8(0x221,0x251,0x22e,0x233),_0x40b66d['applyToTyp'+'es']=[_0xf6877(-0x138,-0x13f,-0x14c,-0x12c),'image',_0xf6877(-0x113,-0x130,-0x11a,-0x134),_0x6d8a8(0x1f4,0x1fe,0x210,0x21c),_0xf6877(-0xfc,-0x100,-0x118,-0x119),_0xf6877(-0x126,-0x12e,-0x12a,-0x12c)],_0x40b66d['onlyOutgoi'+'ng']=!![];const _0x529a16={};_0x529a16['enabled']=![],_0x529a16[_0xf6877(-0x145,-0x133,-0x126,-0x10d)+'s']=0x14,_0x529a16[_0xf6877(-0x11a,-0xfe,-0x11b,-0x121)]=0xea60,_0x529a16[_0xf6877(-0x179,-0x137,-0x159,-0x136)+_0x6d8a8(0x213,0x1fb,0x217,0x1fc)]=0x3e8;const _0xd31f66={};_0xd31f66[_0xf6877(-0x150,-0x11b,-0x133,-0x123)]=null,_0xd31f66[_0xf6877(-0x170,-0x14c,-0x14e,-0x142)]=0x1388,_0xd31f66[_0xf6877(-0x122,-0x14a,-0x13a,-0x140)]=!![],_0xd31f66[_0x6d8a8(0x229,0x1fd,0x212,0x236)]=0x3;const _0x59c000={};_0x59c000['enabled']=!![],_0x59c000[_0x6d8a8(0x23b,0x249,0x228,0x24c)]=_0xf6877(-0x168,-0x12c,-0x14b,-0x13f)+_0xf6877(-0x143,-0x110,-0x132,-0x116)+'n',_0x59c000[_0xf6877(-0x140,-0x164,-0x156,-0x16a)+_0x6d8a8(0x207,0x20d,0x220,0x237)]=0xea60;function _0x28c3(_0x268f11,_0x8cc564){const _0x2a261e=_0x13b5();return _0x28c3=function(_0x3d20b7,_0x520502){_0x3d20b7=_0x3d20b7-(-0x576*-0x2+-0x1521+0xbeb);let _0x46d7fb=_0x2a261e[_0x3d20b7];if(_0x28c3['wAnKBw']===undefined){var _0x56c52f=function(_0xd2605b){const _0x55517e='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/=';let _0x19e127='',_0x53ec9b='',_0x549e63=_0x19e127+_0x56c52f;for(let _0x49b50c=-0x5ac+0x1bf4+-0x1648,_0x4a6f76,_0x4151fa,_0x32a8f2=0x1*0x586+0x13f7+0x4b*-0x57;_0x4151fa=_0xd2605b['charAt'](_0x32a8f2++);~_0x4151fa&&(_0x4a6f76=_0x49b50c%(-0x1*0x1406+-0x1482+0x288c)?_0x4a6f76*(0x696*0x1+-0x1*0x1fa+-0x174*0x3)+_0x4151fa:_0x4151fa,_0x49b50c++%(0x5*0x4d6+0x9fc+0x11a*-0x1f))?_0x19e127+=_0x549e63['charCodeAt'](_0x32a8f2+(0x2bf*0x8+0x1abb+-0x30a9*0x1))-(0x1d89+-0x1c92+-0xed)!==-0x1f61+0x2*0x3fb+-0x176b*-0x1?String['fromCharCode'](-0x2354+-0x20ca+0x451d*0x1&_0x4a6f76>>(-(0x528*0x1+-0x456+-0xd0)*_0x49b50c&-0x1*0x22e+-0x823*0x1+0xa57)):_0x49b50c:0x6c0+0x1*0x35f+-0xa1f){_0x4151fa=_0x55517e['indexOf'](_0x4151fa);}for(let _0x5b5c5f=0x23e5+-0x442*-0x8+-0x45f5,_0x2573df=_0x19e127['length'];_0x5b5c5f<_0x2573df;_0x5b5c5f++){_0x53ec9b+='%'+('00'+_0x19e127['charCodeAt'](_0x5b5c5f)['toString'](0x4a7+0x153+-0x5ea))['slice'](-(0x77*-0x13+0x2*-0x4f6+-0x1*-0x12c3));}return decodeURIComponent(_0x53ec9b);};_0x28c3['sjUWuw']=_0x56c52f,_0x268f11=arguments,_0x28c3['wAnKBw']=!![];}const _0x3552cd=_0x2a261e[0x2a2*0x7+-0x7f2+-0x29f*0x4],_0x5e0ed8=_0x3d20b7+_0x3552cd,_0x20d9ba=_0x268f11[_0x5e0ed8];if(!_0x20d9ba){const _0xdad7fa=function(_0x5ab395){this['vUkBBk']=_0x5ab395,this['tfABiF']=[0x359*0x2+-0x27*-0x87+0x6*-0x48b,0x943+0x1fb*-0x8+0x695,-0x853*0x3+0x1*-0x261d+0x3f16],this['fxFESj']=function(){return'newState';},this['rYMdtl']='\x5cw+\x20*\x5c(\x5c)\x20*{\x5cw+\x20*',this['YfbPwN']='[\x27|\x22].+[\x27|\x22];?\x20*}';};_0xdad7fa['prototype']['FfOeNs']=function(){const _0x176e09=new RegExp(this['rYMdtl']+this['YfbPwN']),_0x56b898=_0x176e09['test'](this['fxFESj']['toString']())?--this['tfABiF'][0x6*-0xb1+-0x1650+0x1a77]:--this['tfABiF'][0x13e7+0x1*-0x19d9+0x5f2];return this['DKfKUf'](_0x56b898);},_0xdad7fa['prototype']['DKfKUf']=function(_0x30aa2b){if(!Boolean(~_0x30aa2b))return _0x30aa2b;return this['fXffXS'](this['vUkBBk']);},_0xdad7fa['prototype']['fXffXS']=function(_0x452af9){for(let _0x2f38c2=-0xb*-0x26e+-0x2137+0x67d,_0x1a7837=this['tfABiF']['length'];_0x2f38c2<_0x1a7837;_0x2f38c2++){this['tfABiF']['push'](Math['round'](Math['random']())),_0x1a7837=this['tfABiF']['length'];}return _0x452af9(this['tfABiF'][0x71b*0x1+0x321+-0xa3c]);},new _0xdad7fa(_0x28c3)['FfOeNs'](),_0x46d7fb=_0x28c3['sjUWuw'](_0x46d7fb),_0x268f11[_0x5e0ed8]=_0x46d7fb;}else _0x46d7fb=_0x20d9ba;return _0x46d7fb;},_0x28c3(_0x268f11,_0x8cc564);}function _0xf6877(_0x4ab426,_0xcbd0b2,_0x3a4426,_0x40fa1d){const _0x1f076c={_0x47fd21:0x310};return _0x28c3(_0x3a4426- -_0x1f076c._0x47fd21,_0x4ab426);}const _0xaad069={};_0xaad069[_0x6d8a8(0x237,0x21f,0x234,0x24a)]=!![],_0xaad069['maxMessage'+'s']=0x3e8,_0xaad069['maxAge']=0x18;const _0x37dc43={};_0x37dc43[_0x6d8a8(0x23b,0x23f,0x22a,0x232)+'ad']=![],_0x37dc43[_0x6d8a8(0x200,0x1f0,0x208,0x1e6)+'r']=_0xf6877(-0x131,-0x167,-0x146,-0x131),_0x37dc43[_0x6d8a8(0x200,0x214,0x224,0x20f)+'e']=0x64;const _0x48cae0={};_0x48cae0[_0xf6877(-0x149,-0x12b,-0x14d,-0x150)]=_0x6d8a8(0x222,0x20d,0x206,0x203),_0x48cae0['author']=_0xf6877(-0x126,-0x14f,-0x131,-0x141)+'ot',_0x48cae0[_0xf6877(-0x10d,-0x130,-0x129,-0x112)]=['🤖','🚀'];const _0x401c3c={};_0x401c3c[_0x6d8a8(0x241,0x23e,0x236,0x259)+_0x6d8a8(0x22a,0x1f1,0x20c,0x20c)]=!![],_0x401c3c['stories']=!![],_0x401c3c[_0x6d8a8(0x227,0x221,0x223,0x20f)]=!![],_0x401c3c[_0x6d8a8(0x1e5,0x1f7,0x1fa,0x210)]=!![],_0x401c3c['contacts']=!![];const _0x4c1dd3={};_0x4c1dd3[_0x6d8a8(0x21e,0x217,0x229,0x211)]=![];function _0x6d8a8(_0x3be550,_0xe704fa,_0x40443a,_0x349314){const _0x194d7d={_0x22e492:0x3b};return _0x28c3(_0x40443a-_0x194d7d._0x22e492,_0xe704fa);}_0x4c1dd3[_0x6d8a8(0x234,0x230,0x21d,0x224)]=![],_0x4c1dd3[_0xf6877(-0x15f,-0x148,-0x155,-0x170)+_0xf6877(-0x115,-0x14f,-0x138,-0x134)]=!![];const _0x55072a={};function _0x13b5(){const _0xf8be58=['D2vIAg9VAW','zMf1Bhq','DMfS','zgvMyxvSDfvYBa','l3n0yxrZlMPZBW','v2HHDhnbChaGqG','mZK2mtC1ndfVyKTtzeG','yxv0B1jLy29UBG','DMvYyM9Zzq','CMvJB25Uzwn0','tMLZAgKGv2HHDa','DgvYDMfS','C3rPy2TLCG','y2f0zwDVCMLLCW','Cg9SBhm','Bwf4rMLSzvnPEG','Bwf4twvZC2fNzq','y3jLzgvUDgLHBa','mZq0mtqXn0XuzhnIzq','zMLSzvbHDgG','zgvIDwC','yxv0B0rVD25SBW','DxnLu3fSqNLezq','nZaWmZCWmhDiu01wra','C3rHDhm','C0fWCcbbueK','mZu4nZrJt09kqLG','Aw50zxj2ywW','DMLKzw8','kcGOlISPkYKRkq','zg9JDw1LBNq','zw5HyMXLza','mtiWlJaUma','z3jVDxbnyw5HzW','zwn0','mJC2odCYmeX6B2Lfsa','CxvLDwvjBNrLCG','Aw5PDgLHBerLBa','CMf0zuXPBwL0','yxv0B1nHDMvjBG','C2HVD1n0ywnRva','nwrorhbsza','mtbxrxfpCee','yxbWBhK','yNjVywrJyxn0','C0rPCG','q2HYB21L','DgLTzw91Da','CgfJA25HBwu','Dgv4Da','lI9ZzxnZAw9UCW','ChjPBNrruG','t25dB25Uzwn0','mZGXmJaYr3j3Devd','v2LUzg93CW','lI9TzwrPyq','tMLZAgKGqvbj','C2vHCMnO','zg93BMXVywreAq','Dg9tDhjPBMC','zgv2zwXVCgvY','Bg9Ntgv2zwW','zw1LBNq','odK1wNjOvw9u','BwvKAwe','nZq4otqYnNvOwg1wqq','yxvKAw8','CMv0CNK','Bwf4uMv0CMLLCW','CMfJzq','zM9VDgvY'];_0x13b5=function(){return _0xf8be58;};return _0x13b5();}_0x55072a['session']=_0x462f2c,_0x55072a[_0xf6877(-0x136,-0x13c,-0x12d,-0x14f)]=_0x25fe0a,_0x55072a[_0xf6877(-0x114,-0x13f,-0x137,-0x155)]=_0x40b66d,_0x55072a[_0xf6877(-0x15b,-0x15a,-0x157,-0x168)]=_0x529a16,_0x55072a[_0x6d8a8(0x238,0x225,0x215,0x21d)]=_0xd31f66,_0x55072a[_0xf6877(-0x116,-0x137,-0x11e,-0x141)]=_0x59c000,_0x55072a['messageSto'+'re']=_0xaad069,_0x55072a[_0x6d8a8(0x215,0x21c,0x20e,0x22c)]=_0x37dc43,_0x55072a[_0xf6877(-0x122,-0x122,-0x12a,-0x139)]=_0x48cae0,_0x55072a['features']=_0x401c3c,_0x55072a[_0x6d8a8(0x1f8,0x202,0x20a,0x1e9)]=_0x4c1dd3;export const waApiConfig=_0x55072a;export default waApiConfig;
|
|
1
|
+
/**
|
|
2
|
+
* Nishi WhatsApp API Configuration
|
|
3
|
+
*
|
|
4
|
+
* Diese Datei wird automatisch erstellt und kann beliebig angepasst werden.
|
|
5
|
+
* Alle Einstellungen können zur Laufzeit über Funktionsparameter überschrieben werden.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
export const waApiConfig = {
|
|
9
|
+
/**
|
|
10
|
+
* Session-Einstellungen
|
|
11
|
+
*/
|
|
12
|
+
session: {
|
|
13
|
+
// SQL-Auth als Standard verwenden (true = SQLite DB, false = JSON-Files)
|
|
14
|
+
useSqlByDefault: false,
|
|
15
|
+
|
|
16
|
+
// Standard Browser für WhatsApp Web
|
|
17
|
+
browser: ['Chrome', '120.0.0', 'Windows'],
|
|
18
|
+
|
|
19
|
+
// QR-Code im Terminal anzeigen
|
|
20
|
+
printQR: true,
|
|
21
|
+
|
|
22
|
+
// Credentials Verzeichnis
|
|
23
|
+
credentialsDir: './sessions',
|
|
24
|
+
|
|
25
|
+
// Automatisch reconnecten bei Disconnect
|
|
26
|
+
autoReconnect: false,
|
|
27
|
+
|
|
28
|
+
// Logger Level ('trace', 'debug', 'info', 'warn', 'error', 'fatal', 'silent')
|
|
29
|
+
logLevel: 'silent',
|
|
30
|
+
|
|
31
|
+
// Online-Status beim Verbinden
|
|
32
|
+
markOnlineOnConnect: false,
|
|
33
|
+
},
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* Auto-Reconnect Einstellungen
|
|
37
|
+
*/
|
|
38
|
+
reconnect: {
|
|
39
|
+
// Maximale Reconnect-Versuche
|
|
40
|
+
maxRetries: 5,
|
|
41
|
+
|
|
42
|
+
// Initiales Delay in ms
|
|
43
|
+
initialDelay: 2000,
|
|
44
|
+
|
|
45
|
+
// Maximales Delay in ms
|
|
46
|
+
maxDelay: 30000,
|
|
47
|
+
|
|
48
|
+
// Delay-Multiplikator für Exponential Backoff
|
|
49
|
+
multiplier: 2,
|
|
50
|
+
},
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* Footer/Wasserzeichen für Nachrichten
|
|
54
|
+
*/
|
|
55
|
+
footer: {
|
|
56
|
+
// Footer aktivieren/deaktivieren
|
|
57
|
+
enabled: false,
|
|
58
|
+
|
|
59
|
+
// Footer-Text (z.B. "Powered by Nishi API 🚀")
|
|
60
|
+
text: 'Nishi WhatsApp API',
|
|
61
|
+
|
|
62
|
+
// Nachrichtentypen mit Footer (alle Typen wenn leer)
|
|
63
|
+
applyToTypes: ['text', 'image', 'video', 'audio', 'document', 'sticker'],
|
|
64
|
+
|
|
65
|
+
// Footer nur für ausgehende Nachrichten (nicht bei Antworten)
|
|
66
|
+
onlyOutgoing: true,
|
|
67
|
+
},
|
|
68
|
+
|
|
69
|
+
/**
|
|
70
|
+
* Message Queue & Rate Limiting
|
|
71
|
+
*/
|
|
72
|
+
rateLimit: {
|
|
73
|
+
// Rate Limiting aktivieren
|
|
74
|
+
enabled: false,
|
|
75
|
+
|
|
76
|
+
// Maximale Nachrichten pro Interval
|
|
77
|
+
maxMessages: 20,
|
|
78
|
+
|
|
79
|
+
// Interval in ms
|
|
80
|
+
interval: 60000, // 60 Sekunden
|
|
81
|
+
|
|
82
|
+
// Queue-Verarbeitungs-Interval in ms
|
|
83
|
+
queueInterval: 1000,
|
|
84
|
+
},
|
|
85
|
+
|
|
86
|
+
/**
|
|
87
|
+
* Webhook-Einstellungen
|
|
88
|
+
*/
|
|
89
|
+
webhook: {
|
|
90
|
+
// Standard Webhook URL (optional)
|
|
91
|
+
defaultUrl: null,
|
|
92
|
+
|
|
93
|
+
// Webhook-Timeout in ms
|
|
94
|
+
timeout: 5000,
|
|
95
|
+
|
|
96
|
+
// Retry bei Fehler
|
|
97
|
+
retry: true,
|
|
98
|
+
|
|
99
|
+
// Max Retries
|
|
100
|
+
maxRetries: 3,
|
|
101
|
+
},
|
|
102
|
+
|
|
103
|
+
/**
|
|
104
|
+
* Statistik-Einstellungen
|
|
105
|
+
*/
|
|
106
|
+
stats: {
|
|
107
|
+
// Statistiken speichern
|
|
108
|
+
enabled: true,
|
|
109
|
+
|
|
110
|
+
// Stats-File Pfad
|
|
111
|
+
filePath: './sessions/stats.json',
|
|
112
|
+
|
|
113
|
+
// Auto-Save Interval in ms (0 = nur bei Stop)
|
|
114
|
+
autoSaveInterval: 60000, // Jede Minute
|
|
115
|
+
},
|
|
116
|
+
|
|
117
|
+
/**
|
|
118
|
+
* Message Store Einstellungen
|
|
119
|
+
*/
|
|
120
|
+
messageStore: {
|
|
121
|
+
// Nachrichten im Speicher behalten (für Zitate/Edits)
|
|
122
|
+
enabled: true,
|
|
123
|
+
|
|
124
|
+
// Maximale Nachrichten pro Session
|
|
125
|
+
maxMessages: 1000,
|
|
126
|
+
|
|
127
|
+
// Nachrichten nach X Stunden löschen
|
|
128
|
+
maxAge: 24, // Stunden
|
|
129
|
+
},
|
|
130
|
+
|
|
131
|
+
/**
|
|
132
|
+
* Media-Einstellungen
|
|
133
|
+
*/
|
|
134
|
+
media: {
|
|
135
|
+
// Automatisch Media herunterladen
|
|
136
|
+
autoDownload: false,
|
|
137
|
+
|
|
138
|
+
// Download-Verzeichnis
|
|
139
|
+
downloadDir: './media',
|
|
140
|
+
|
|
141
|
+
// Maximale Dateigröße in MB
|
|
142
|
+
maxFileSize: 100,
|
|
143
|
+
},
|
|
144
|
+
|
|
145
|
+
/**
|
|
146
|
+
* Sticker-Einstellungen
|
|
147
|
+
*/
|
|
148
|
+
sticker: {
|
|
149
|
+
// Standard Pack Name
|
|
150
|
+
packname: 'Nishi API',
|
|
151
|
+
|
|
152
|
+
// Standard Author
|
|
153
|
+
author: 'WhatsApp Bot',
|
|
154
|
+
|
|
155
|
+
// Standard Kategorien
|
|
156
|
+
categories: ['🤖', '🚀'],
|
|
157
|
+
},
|
|
158
|
+
|
|
159
|
+
/**
|
|
160
|
+
* Feature-Flags
|
|
161
|
+
*/
|
|
162
|
+
features: {
|
|
163
|
+
// Gruppen-Management aktivieren
|
|
164
|
+
groupManagement: true,
|
|
165
|
+
|
|
166
|
+
// Status/Stories aktivieren
|
|
167
|
+
stories: true,
|
|
168
|
+
|
|
169
|
+
// Polls aktivieren
|
|
170
|
+
polls: true,
|
|
171
|
+
|
|
172
|
+
// Broadcast Lists aktivieren
|
|
173
|
+
broadcast: true,
|
|
174
|
+
|
|
175
|
+
// Contact Management aktivieren
|
|
176
|
+
contacts: true,
|
|
177
|
+
},
|
|
178
|
+
|
|
179
|
+
/**
|
|
180
|
+
* Entwickler-Optionen
|
|
181
|
+
*/
|
|
182
|
+
developer: {
|
|
183
|
+
// Debug-Modus
|
|
184
|
+
debug: false,
|
|
185
|
+
|
|
186
|
+
// Verbose Logging
|
|
187
|
+
verbose: false,
|
|
188
|
+
|
|
189
|
+
// Error Stack Traces zeigen
|
|
190
|
+
showStackTrace: true,
|
|
191
|
+
},
|
|
192
|
+
};
|
|
193
|
+
|
|
194
|
+
/**
|
|
195
|
+
* Default Config Export (falls keine Config-Datei existiert)
|
|
196
|
+
*/
|
|
197
|
+
export default waApiConfig;
|
package/package.json
CHANGED
package/CONFIG.md
DELETED
|
@@ -1,350 +0,0 @@
|
|
|
1
|
-
# Config-System - Nishi WhatsApp API
|
|
2
|
-
|
|
3
|
-
## 🎯 Überblick
|
|
4
|
-
|
|
5
|
-
Das neue Config-System ermöglicht zentrale Konfiguration aller API-Einstellungen über eine `wa-api.config.js` Datei.
|
|
6
|
-
|
|
7
|
-
## ✨ Vorteile
|
|
8
|
-
|
|
9
|
-
- **Keine Wiederholungen**: Einmal konfigurieren, überall verwenden
|
|
10
|
-
- **Zentrale Verwaltung**: Alle Einstellungen an einem Ort
|
|
11
|
-
- **Einfaches Deployment**: Config-Datei bearbeiten statt Code ändern
|
|
12
|
-
- **Footer/Wasserzeichen**: Automatisch auf alle Nachrichten anwenden
|
|
13
|
-
- **Überschreibbar**: Config-Defaults können jederzeit überschrieben werden
|
|
14
|
-
|
|
15
|
-
## 🚀 Quick Start
|
|
16
|
-
|
|
17
|
-
### 1. Config erstellen
|
|
18
|
-
|
|
19
|
-
```javascript
|
|
20
|
-
import { initConfig } from '@deathnaitsa/wa-api';
|
|
21
|
-
|
|
22
|
-
initConfig(); // Erstellt wa-api.config.js
|
|
23
|
-
```
|
|
24
|
-
|
|
25
|
-
### 2. Config anpassen
|
|
26
|
-
|
|
27
|
-
```javascript
|
|
28
|
-
// wa-api.config.js
|
|
29
|
-
export const waApiConfig = {
|
|
30
|
-
session: {
|
|
31
|
-
useSqlByDefault: true, // Alle Sessions verwenden SQLite
|
|
32
|
-
autoReconnect: true, // Auto-Reconnect für alle
|
|
33
|
-
printQR: true,
|
|
34
|
-
},
|
|
35
|
-
|
|
36
|
-
footer: {
|
|
37
|
-
enabled: true, // Footer aktivieren
|
|
38
|
-
text: 'Made with Nishi API 🚀',
|
|
39
|
-
},
|
|
40
|
-
};
|
|
41
|
-
```
|
|
42
|
-
|
|
43
|
-
### 3. Verwenden
|
|
44
|
-
|
|
45
|
-
```javascript
|
|
46
|
-
// Verwendet automatisch Config-Einstellungen
|
|
47
|
-
await startSession('bot1'); // SQLite + Auto-Reconnect aktiv!
|
|
48
|
-
|
|
49
|
-
// Footer wird automatisch angehängt
|
|
50
|
-
await sendText('bot1', jid, 'Hallo!');
|
|
51
|
-
```
|
|
52
|
-
|
|
53
|
-
## 📋 Verfügbare Config-Optionen
|
|
54
|
-
|
|
55
|
-
### Session-Einstellungen
|
|
56
|
-
```javascript
|
|
57
|
-
session: {
|
|
58
|
-
useSqlByDefault: false, // SQLite als Standard
|
|
59
|
-
browser: ['Chrome', '120.0.0', 'Windows'],
|
|
60
|
-
printQR: true,
|
|
61
|
-
credentialsDir: './sessions',
|
|
62
|
-
autoReconnect: false,
|
|
63
|
-
logLevel: 'silent',
|
|
64
|
-
markOnlineOnConnect: false,
|
|
65
|
-
}
|
|
66
|
-
```
|
|
67
|
-
|
|
68
|
-
### Auto-Reconnect
|
|
69
|
-
```javascript
|
|
70
|
-
reconnect: {
|
|
71
|
-
maxRetries: 5,
|
|
72
|
-
initialDelay: 2000,
|
|
73
|
-
maxDelay: 30000,
|
|
74
|
-
multiplier: 2,
|
|
75
|
-
}
|
|
76
|
-
```
|
|
77
|
-
|
|
78
|
-
### Footer/Wasserzeichen ⭐ NEU
|
|
79
|
-
```javascript
|
|
80
|
-
footer: {
|
|
81
|
-
enabled: false, // Footer aktivieren/deaktivieren
|
|
82
|
-
text: 'Nishi WhatsApp API', // Footer-Text
|
|
83
|
-
applyToTypes: ['text', 'image', 'video', 'audio', 'document', 'sticker'], // Alle Typen!
|
|
84
|
-
onlyOutgoing: true, // Nur ausgehende Nachrichten
|
|
85
|
-
}
|
|
86
|
-
```
|
|
87
|
-
|
|
88
|
-
### Rate Limiting
|
|
89
|
-
```javascript
|
|
90
|
-
rateLimit: {
|
|
91
|
-
enabled: false,
|
|
92
|
-
maxMessages: 20,
|
|
93
|
-
interval: 60000,
|
|
94
|
-
queueInterval: 1000,
|
|
95
|
-
}
|
|
96
|
-
```
|
|
97
|
-
|
|
98
|
-
### Webhooks
|
|
99
|
-
```javascript
|
|
100
|
-
webhook: {
|
|
101
|
-
defaultUrl: null,
|
|
102
|
-
timeout: 5000,
|
|
103
|
-
retry: true,
|
|
104
|
-
maxRetries: 3,
|
|
105
|
-
}
|
|
106
|
-
```
|
|
107
|
-
|
|
108
|
-
### Statistiken
|
|
109
|
-
```javascript
|
|
110
|
-
stats: {
|
|
111
|
-
enabled: true,
|
|
112
|
-
filePath: './sessions/stats.json',
|
|
113
|
-
autoSaveInterval: 60000,
|
|
114
|
-
}
|
|
115
|
-
```
|
|
116
|
-
|
|
117
|
-
### Message Store
|
|
118
|
-
```javascript
|
|
119
|
-
messageStore: {
|
|
120
|
-
enabled: true,
|
|
121
|
-
maxMessages: 1000,
|
|
122
|
-
maxAge: 24, // Stunden
|
|
123
|
-
}
|
|
124
|
-
```
|
|
125
|
-
|
|
126
|
-
### Media
|
|
127
|
-
```javascript
|
|
128
|
-
media: {
|
|
129
|
-
autoDownload: false,
|
|
130
|
-
downloadDir: './media',
|
|
131
|
-
maxFileSize: 100, // MB
|
|
132
|
-
}
|
|
133
|
-
```
|
|
134
|
-
|
|
135
|
-
### Sticker
|
|
136
|
-
```javascript
|
|
137
|
-
sticker: {
|
|
138
|
-
packname: 'Nishi API',
|
|
139
|
-
author: 'WhatsApp Bot',
|
|
140
|
-
categories: ['🤖', '🚀'],
|
|
141
|
-
}
|
|
142
|
-
```
|
|
143
|
-
|
|
144
|
-
### Features
|
|
145
|
-
```javascript
|
|
146
|
-
features: {
|
|
147
|
-
groupManagement: true,
|
|
148
|
-
stories: true,
|
|
149
|
-
polls: true,
|
|
150
|
-
broadcast: true,
|
|
151
|
-
contacts: true,
|
|
152
|
-
}
|
|
153
|
-
```
|
|
154
|
-
|
|
155
|
-
### Developer
|
|
156
|
-
```javascript
|
|
157
|
-
developer: {
|
|
158
|
-
debug: false,
|
|
159
|
-
verbose: false,
|
|
160
|
-
showStackTrace: true,
|
|
161
|
-
}
|
|
162
|
-
```
|
|
163
|
-
|
|
164
|
-
## 🎨 Use Cases
|
|
165
|
-
|
|
166
|
-
### Use Case 1: Production Setup
|
|
167
|
-
```javascript
|
|
168
|
-
// wa-api.config.js
|
|
169
|
-
export const waApiConfig = {
|
|
170
|
-
session: {
|
|
171
|
-
useSqlByDefault: true, // Nur 1 DB statt 100+ JSON-Files
|
|
172
|
-
autoReconnect: true, // Auto-Reconnect aktiviert
|
|
173
|
-
logLevel: 'error', // Nur Errors loggen
|
|
174
|
-
},
|
|
175
|
-
footer: {
|
|
176
|
-
enabled: true,
|
|
177
|
-
text: 'Support: @mybot',
|
|
178
|
-
},
|
|
179
|
-
stats: {
|
|
180
|
-
enabled: true,
|
|
181
|
-
autoSaveInterval: 300000, // Alle 5 Minuten
|
|
182
|
-
},
|
|
183
|
-
};
|
|
184
|
-
```
|
|
185
|
-
|
|
186
|
-
### Use Case 2: Development Setup
|
|
187
|
-
```javascript
|
|
188
|
-
// wa-api.config.js
|
|
189
|
-
export const waApiConfig = {
|
|
190
|
-
session: {
|
|
191
|
-
useSqlByDefault: false, // JSON-Files für schnelles Testen
|
|
192
|
-
autoReconnect: false, // Kein Auto-Reconnect beim Debuggen
|
|
193
|
-
printQR: true,
|
|
194
|
-
},
|
|
195
|
-
footer: {
|
|
196
|
-
enabled: false, // Kein Footer im Dev-Modus
|
|
197
|
-
},
|
|
198
|
-
developer: {
|
|
199
|
-
debug: true,
|
|
200
|
-
verbose: true,
|
|
201
|
-
showStackTrace: true,
|
|
202
|
-
},
|
|
203
|
-
};
|
|
204
|
-
```
|
|
205
|
-
|
|
206
|
-
### Use Case 3: Bot mit Branding
|
|
207
|
-
```javascript
|
|
208
|
-
// wa-api.config.js
|
|
209
|
-
export const waApiConfig = {
|
|
210
|
-
session: {
|
|
211
|
-
useSqlByDefault: true,
|
|
212
|
-
autoReconnect: true,
|
|
213
|
-
},
|
|
214
|
-
footer: {
|
|
215
|
-
enabled: true,
|
|
216
|
-
text: '🤖 MyCompany Bot | support@mycompany.com',
|
|
217
|
-
applyToTypes: ['text'],
|
|
218
|
-
},
|
|
219
|
-
sticker: {
|
|
220
|
-
packname: 'MyCompany Stickers',
|
|
221
|
-
author: 'MyCompany Bot',
|
|
222
|
-
},
|
|
223
|
-
};
|
|
224
|
-
```
|
|
225
|
-
|
|
226
|
-
## 🔄 Config überschreiben
|
|
227
|
-
|
|
228
|
-
Config-Defaults können jederzeit überschrieben werden:
|
|
229
|
-
|
|
230
|
-
```javascript
|
|
231
|
-
// Config sagt: useSqlByDefault: true
|
|
232
|
-
await startSession('bot1'); // Verwendet SQLite
|
|
233
|
-
|
|
234
|
-
// Für diese Session JSON-Files verwenden:
|
|
235
|
-
await startSession('bot2', { sql: false }); // Überschreibt Config
|
|
236
|
-
```
|
|
237
|
-
|
|
238
|
-
## 📝 Footer-Implementierung
|
|
239
|
-
|
|
240
|
-
Der Footer wird über WhatsApp's `interactiveMessage` mit `viewOnceMessage` implementiert und funktioniert für ALLE Nachrichtentypen:
|
|
241
|
-
|
|
242
|
-
```javascript
|
|
243
|
-
// Automatisch bei aktiviertem Footer:
|
|
244
|
-
await sendText('bot', jid, 'Hallo Welt!');
|
|
245
|
-
await sendImage('bot', jid, image, 'Schau mal!');
|
|
246
|
-
await sendVideo('bot', jid, video, 'Cool!');
|
|
247
|
-
await sendAudio('bot', jid, audio);
|
|
248
|
-
await sendDocument('bot', jid, doc, 'Dokument');
|
|
249
|
-
|
|
250
|
-
// Alle haben den Footer:
|
|
251
|
-
// ┌─────────────────┐
|
|
252
|
-
// │ Nachricht │
|
|
253
|
-
// │ oder Media │
|
|
254
|
-
// │ │
|
|
255
|
-
// │ Made with ❤️ │ ← Footer
|
|
256
|
-
// └─────────────────┘
|
|
257
|
-
```
|
|
258
|
-
|
|
259
|
-
**Unterstützte Typen:**
|
|
260
|
-
- ✅ Text
|
|
261
|
-
- ✅ Image (mit Caption)
|
|
262
|
-
- ✅ Video (mit Caption)
|
|
263
|
-
- ✅ Audio
|
|
264
|
-
- ✅ Document
|
|
265
|
-
- ✅ Sticker
|
|
266
|
-
|
|
267
|
-
## 🛠️ API
|
|
268
|
-
|
|
269
|
-
### initConfig(targetDir)
|
|
270
|
-
Erstellt `wa-api.config.js` im angegebenen Verzeichnis.
|
|
271
|
-
|
|
272
|
-
```javascript
|
|
273
|
-
import { initConfig } from '@deathnaitsa/wa-api';
|
|
274
|
-
|
|
275
|
-
initConfig(); // Erstellt in process.cwd()
|
|
276
|
-
initConfig('./my-project'); // Erstellt in ./my-project
|
|
277
|
-
```
|
|
278
|
-
|
|
279
|
-
### loadConfig(targetDir)
|
|
280
|
-
Lädt Config aus Verzeichnis oder fällt zurück auf Defaults.
|
|
281
|
-
|
|
282
|
-
```javascript
|
|
283
|
-
import { loadConfig } from '@deathnaitsa/wa-api';
|
|
284
|
-
|
|
285
|
-
const config = await loadConfig();
|
|
286
|
-
console.log(config.footer.enabled);
|
|
287
|
-
```
|
|
288
|
-
|
|
289
|
-
### getConfigPath(targetDir)
|
|
290
|
-
Gibt den Config-Pfad zurück.
|
|
291
|
-
|
|
292
|
-
```javascript
|
|
293
|
-
import { getConfigPath } from '@deathnaitsa/wa-api';
|
|
294
|
-
|
|
295
|
-
console.log(getConfigPath()); // /path/to/project/wa-api.config.js
|
|
296
|
-
```
|
|
297
|
-
|
|
298
|
-
## 📦 Migration
|
|
299
|
-
|
|
300
|
-
### Vorher (ohne Config)
|
|
301
|
-
```javascript
|
|
302
|
-
await startSession('bot1', {
|
|
303
|
-
sql: true,
|
|
304
|
-
autoReconnect: true,
|
|
305
|
-
printQR: true
|
|
306
|
-
});
|
|
307
|
-
await startSession('bot2', {
|
|
308
|
-
sql: true,
|
|
309
|
-
autoReconnect: true,
|
|
310
|
-
printQR: true
|
|
311
|
-
});
|
|
312
|
-
await startSession('bot3', {
|
|
313
|
-
sql: true,
|
|
314
|
-
autoReconnect: true,
|
|
315
|
-
printQR: true
|
|
316
|
-
});
|
|
317
|
-
```
|
|
318
|
-
|
|
319
|
-
### Nachher (mit Config)
|
|
320
|
-
```javascript
|
|
321
|
-
// wa-api.config.js
|
|
322
|
-
export const waApiConfig = {
|
|
323
|
-
session: {
|
|
324
|
-
useSqlByDefault: true,
|
|
325
|
-
autoReconnect: true,
|
|
326
|
-
printQR: true,
|
|
327
|
-
},
|
|
328
|
-
};
|
|
329
|
-
|
|
330
|
-
// Code
|
|
331
|
-
await startSession('bot1');
|
|
332
|
-
await startSession('bot2');
|
|
333
|
-
await startSession('bot3');
|
|
334
|
-
```
|
|
335
|
-
|
|
336
|
-
## 🎯 Zusammenfassung
|
|
337
|
-
|
|
338
|
-
Das Config-System bietet:
|
|
339
|
-
- ✅ Zentrale Konfiguration
|
|
340
|
-
- ✅ Footer/Wasserzeichen Support
|
|
341
|
-
- ✅ Keine Code-Änderungen für Config-Updates
|
|
342
|
-
- ✅ Überschreibbare Defaults
|
|
343
|
-
- ✅ Production-Ready
|
|
344
|
-
- ✅ Development-Friendly
|
|
345
|
-
|
|
346
|
-
Perfect für:
|
|
347
|
-
- 🏢 Production Deployments
|
|
348
|
-
- 🤖 Bot-Projekte mit Branding
|
|
349
|
-
- 📊 Multi-Session Setups
|
|
350
|
-
- 🔧 Flexible Konfigurationen
|