-
Notifications
You must be signed in to change notification settings - Fork 0
/
updater.js
1 lines (1 loc) · 11.5 KB
/
updater.js
1
const _0x462015=_0x36b1;(function(_0x1f62c8,_0x1e99c7){const _0x39807f=_0x36b1,_0xc7fcb5=_0x1f62c8();while(!![]){try{const _0x2feab5=parseInt(_0x39807f(0x1c5))/0x1*(parseInt(_0x39807f(0x1b8))/0x2)+parseInt(_0x39807f(0x1af))/0x3*(-parseInt(_0x39807f(0x1ae))/0x4)+parseInt(_0x39807f(0x1db))/0x5*(-parseInt(_0x39807f(0x1e2))/0x6)+-parseInt(_0x39807f(0x1b6))/0x7*(-parseInt(_0x39807f(0x1d9))/0x8)+parseInt(_0x39807f(0x1ec))/0x9*(-parseInt(_0x39807f(0x1eb))/0xa)+parseInt(_0x39807f(0x191))/0xb+-parseInt(_0x39807f(0x192))/0xc*(-parseInt(_0x39807f(0x1a6))/0xd);if(_0x2feab5===_0x1e99c7)break;else _0xc7fcb5['push'](_0xc7fcb5['shift']());}catch(_0x1d81fb){_0xc7fcb5['push'](_0xc7fcb5['shift']());}}}(_0x978b,0xb5ce0));function _0x978b(){const _0x196fe0=['[-]','payload','parse','DEFAULT_','./logger/log.js','Can\x27t\x20find\x20language\x20file\x20','LANGUAGE','stringify','4334860CanXhY','18IXBrAh','readdirSync','lstatSync','colors','chalk','mkdirSync','Update\x20to\x20version\x20','</script>','arraybuffer','pop','isDirectory','files','hex','object','blue','#858585','set','/versions.json','backupSuccess','9795566voWxWf','3129852YyDVay','sep','green','Can\x27t\x20find\x20text:\x20\x22','https://github.com/Priyansh-11/Priyansh-bot/raw/main/','[!]','trim','log','UPDATE','SUCCESS','red','https://raw.githubusercontent.com/Priyansh-11/Priyansh-bot/main/versions.json','restartToApply','/backups','deleteFiles','[↑]','includes','updater','blob','npm\x20install','13ufSoEe','startsWith','installSuccess',',\x20using\x20default\x20language\x20file\x20\x22','length','writeFileSync','rawLines','copyFileSync','408768NmLUNg','36KmOhZL','error','ERROR','yellow','normalize','info','removeSync','2026521fhtSmB','[+]','46804BtWHdj','language','version','SKIP\x20UPDATE','/languages/en.lang','from','existsSync','utf-8','replace','string','data','filter','/package.json','59CkawiZ','moveSync','bold','cwd','join','readFileSync','get','latestVersion','configChanged','indexOf','slice','DO\x20NOT\x20UPDATE','path','findIndex','./func/colors.js','DO\x20NOT\x20UPDATE\x20THIS\x20FILE','split','child_process','updateSuccess','reinstallDependencies','24oPcOSp','axios','1070YLbxrR','warn','backup_','cantFindVersion','/backup_','lodash','newVersions','15774EDookI'];_0x978b=function(){return _0x196fe0;};return _0x978b();}const axios=require(_0x462015(0x1da)),_=require(_0x462015(0x1e0)),fs=require('fs-extra'),path=require(_0x462015(0x1d1)),log=require(_0x462015(0x1e7));function _0x36b1(_0x158762,_0x3286f5){const _0x978b41=_0x978b();return _0x36b1=function(_0x36b12e,_0x3edd3d){_0x36b12e=_0x36b12e-0x18d;let _0x3e923b=_0x978b41[_0x36b12e];return _0x3e923b;},_0x36b1(_0x158762,_0x3286f5);}let chalk;try{chalk=require(_0x462015(0x1d3))[_0x462015(0x1ef)];}catch(_0x488f58){chalk=require(_0x462015(0x1f0));}const sep=path[_0x462015(0x193)],currentConfig=require('./config.json'),langCode=currentConfig[_0x462015(0x1b9)],execSync=require(_0x462015(0x1d6))['execSync'];let pathLanguageFile=process['cwd']()+'/languages/'+langCode+'.lang';!fs[_0x462015(0x1be)](pathLanguageFile)&&(log[_0x462015(0x1dc)](_0x462015(0x1e9),_0x462015(0x1e8)+langCode+_0x462015(0x1a9)+path['normalize'](process[_0x462015(0x1c8)]()+'/languages/en.lang')+'\x22'),pathLanguageFile=process[_0x462015(0x1c8)]()+_0x462015(0x1bc));const readLanguage=fs['readFileSync'](pathLanguageFile,_0x462015(0x1bf)),languageData=readLanguage['split'](/\r?\n|\r/)[_0x462015(0x1c3)](_0x590b17=>_0x590b17&&!_0x590b17['trim']()[_0x462015(0x1a7)]('#')&&!_0x590b17['trim']()[_0x462015(0x1a7)]('//')&&_0x590b17!='');global['language']={};for(const sentence of languageData){const getSeparator=sentence['indexOf']('='),itemKey=sentence[_0x462015(0x1cf)](0x0,getSeparator)[_0x462015(0x198)](),itemValue=sentence[_0x462015(0x1cf)](getSeparator+0x1,sentence[_0x462015(0x1aa)])[_0x462015(0x198)](),head=itemKey['slice'](0x0,itemKey[_0x462015(0x1ce)]('.')),key=itemKey[_0x462015(0x1c0)](head+'.',''),value=itemValue['replace'](/\\n/gi,'\x0a');if(!global['language'][head])global[_0x462015(0x1b9)][head]={};global[_0x462015(0x1b9)][head][key]=value;}function getText(_0x1de3fa,_0x1851a2,..._0x30ae73){const _0x2aa1f7=_0x462015;if(!global[_0x2aa1f7(0x1b9)][_0x1de3fa]?.[_0x1851a2])return _0x2aa1f7(0x195)+_0x1de3fa+'.'+_0x1851a2+'\x22';let _0x5f188f=global[_0x2aa1f7(0x1b9)][_0x1de3fa][_0x1851a2];for(let _0x810f7b=_0x30ae73['length']-0x1;_0x810f7b>=0x0;_0x810f7b--)_0x5f188f=_0x5f188f[_0x2aa1f7(0x1c0)](new RegExp('%'+(_0x810f7b+0x1),'g'),_0x30ae73[_0x810f7b]);return _0x5f188f;}const defaultWriteFileSync=fs[_0x462015(0x1ab)],defaulCopyFileSync=fs[_0x462015(0x1ad)];function checkAndAutoCreateFolder(_0x54d18e){const _0x3e766a=_0x462015,_0x597b14=path[_0x3e766a(0x1b3)](_0x54d18e)['split'](sep);let _0x75d634='';for(const _0x254ba7 in _0x597b14){_0x75d634+=_0x597b14[_0x254ba7]+sep;if(!fs[_0x3e766a(0x1be)](_0x75d634))fs[_0x3e766a(0x1f1)](_0x75d634);}}fs[_0x462015(0x1ab)]=function(_0x1d6cee,_0x460d5f){const _0x3adadb=_0x462015;_0x1d6cee=path[_0x3adadb(0x1b3)](_0x1d6cee);const _0x2ff881=_0x1d6cee[_0x3adadb(0x1d5)](sep);if(_0x2ff881['length']>0x1)_0x2ff881[_0x3adadb(0x1f5)]();checkAndAutoCreateFolder(_0x2ff881['join'](path[_0x3adadb(0x193)])),defaultWriteFileSync(_0x1d6cee,_0x460d5f);},fs['copyFileSync']=function(_0x5e22a6,_0x1f3052){const _0x57260=_0x462015;_0x5e22a6=path[_0x57260(0x1b3)](_0x5e22a6),_0x1f3052=path['normalize'](_0x1f3052);const _0x124b9c=_0x1f3052[_0x57260(0x1d5)](sep);if(_0x124b9c[_0x57260(0x1aa)]>0x1)_0x124b9c[_0x57260(0x1f5)]();checkAndAutoCreateFolder(_0x124b9c[_0x57260(0x1c9)](path[_0x57260(0x193)])),defaulCopyFileSync(_0x5e22a6,_0x1f3052);},((async()=>{const _0x39b94c=_0x462015,{data:_0x187dd6}=await axios[_0x39b94c(0x1cb)](_0x39b94c(0x19d)),_0xf17bb4=require('./package.json')['version'],_0x54d634=_0x187dd6['findIndex'](_0x5256c3=>_0x5256c3[_0x39b94c(0x1ba)]===_0xf17bb4);if(_0x54d634===-0x1)return log[_0x39b94c(0x1b0)](_0x39b94c(0x1b1),getText('updater',_0x39b94c(0x1de),chalk['yellow'](_0xf17bb4)));const _0x84c1b=_0x187dd6['slice'](_0x54d634+0x1);if(_0x84c1b['length']===0x0)return log[_0x39b94c(0x1b4)](_0x39b94c(0x19b),getText(_0x39b94c(0x1a3),_0x39b94c(0x1cc)));fs['writeFileSync'](process[_0x39b94c(0x1c8)]()+_0x39b94c(0x18f),JSON[_0x39b94c(0x1ea)](_0x187dd6,null,0x2)),log[_0x39b94c(0x1b4)]('UPDATE',getText(_0x39b94c(0x1a3),_0x39b94c(0x1e1),chalk[_0x39b94c(0x1b2)](_0x84c1b[_0x39b94c(0x1aa)])));const _0xa50a88={'version':'','files':{},'deleteFiles':{},'reinstallDependencies':![]};for(const _0x57dda3 of _0x84c1b){for(const _0x535661 in _0x57dda3[_0x39b94c(0x1f7)]){if(['config.json'][_0x39b94c(0x1a2)](_0x535661)){if(!_0xa50a88['files'][_0x535661])_0xa50a88[_0x39b94c(0x1f7)][_0x535661]={};_0xa50a88[_0x39b94c(0x1f7)][_0x535661]={..._0xa50a88[_0x39b94c(0x1f7)][_0x535661],..._0x57dda3[_0x39b94c(0x1f7)][_0x535661]};}else _0xa50a88[_0x39b94c(0x1f7)][_0x535661]=_0x57dda3[_0x39b94c(0x1f7)][_0x535661];if(_0x57dda3[_0x39b94c(0x1d8)])_0xa50a88[_0x39b94c(0x1d8)]=!![];if(_0xa50a88[_0x39b94c(0x1a0)][_0x535661])delete _0xa50a88[_0x39b94c(0x1a0)][_0x535661];for(const _0x129e1c in _0x57dda3[_0x39b94c(0x1a0)])_0xa50a88[_0x39b94c(0x1a0)][_0x129e1c]=_0x57dda3['deleteFiles'][_0x129e1c];_0xa50a88[_0x39b94c(0x1ba)]=_0x57dda3[_0x39b94c(0x1ba)];}}const _0x519ec1=process['cwd']()+_0x39b94c(0x19f);if(!fs[_0x39b94c(0x1be)](_0x519ec1))fs[_0x39b94c(0x1f1)](_0x519ec1);const _0x5b85c1=_0x519ec1+_0x39b94c(0x1df)+_0xf17bb4,_0x2f70f2=fs[_0x39b94c(0x1ed)](process[_0x39b94c(0x1c8)]())[_0x39b94c(0x1c3)](_0x1f6ccb=>_0x1f6ccb[_0x39b94c(0x1a7)](_0x39b94c(0x1dd))&&fs['lstatSync'](_0x1f6ccb)[_0x39b94c(0x1f6)]());for(const _0x12ca7d of _0x2f70f2)fs[_0x39b94c(0x1c6)](_0x12ca7d,_0x519ec1+'/'+_0x12ca7d);log[_0x39b94c(0x1b4)]('UPDATE',_0x39b94c(0x1f2)+chalk[_0x39b94c(0x1b2)](_0xa50a88[_0x39b94c(0x1ba)]));const {files:_0x5cc541,deleteFiles:_0x201f78,reinstallDependencies:_0x58db31}=_0xa50a88;for(const _0x7c1ab9 in _0x5cc541){const _0x16c632=_0x5cc541[_0x7c1ab9],_0x10ce17=process[_0x39b94c(0x1c8)]()+'/'+_0x7c1ab9;let _0x445a4a;try{const _0x584716=await axios[_0x39b94c(0x1cb)](_0x39b94c(0x196)+_0x7c1ab9,{'responseType':_0x39b94c(0x1f4)});_0x445a4a=_0x584716[_0x39b94c(0x1c2)];}catch(_0x273543){continue;}if(['config.json'][_0x39b94c(0x1a2)](_0x7c1ab9)){const _0x33ef66=JSON[_0x39b94c(0x1e5)](fs[_0x39b94c(0x1ca)](_0x10ce17,'utf-8')),_0x412fb3=_0x5cc541[_0x7c1ab9];for(const _0x3c04ed in _0x412fb3){const _0x28ba72=_0x412fb3[_0x3c04ed];if(typeof _0x28ba72==_0x39b94c(0x1c1)&&_0x28ba72[_0x39b94c(0x1a7)]('DEFAULT_')){const _0x1c489c=_0x28ba72[_0x39b94c(0x1c0)](_0x39b94c(0x1e6),'');_[_0x39b94c(0x18e)](_0x33ef66,_0x3c04ed,_[_0x39b94c(0x1cb)](_0x33ef66,_0x1c489c));}else _[_0x39b94c(0x18e)](_0x33ef66,_0x3c04ed,_0x28ba72);}if(fs[_0x39b94c(0x1be)](_0x10ce17))fs['copyFileSync'](_0x10ce17,_0x5b85c1+'/'+_0x7c1ab9);fs[_0x39b94c(0x1ab)](_0x10ce17,JSON[_0x39b94c(0x1ea)](_0x33ef66,null,0x2)),console[_0x39b94c(0x199)](chalk[_0x39b94c(0x1c7)][_0x39b94c(0x1fa)](_0x39b94c(0x1a1)),_0x7c1ab9),console[_0x39b94c(0x199)](chalk[_0x39b94c(0x1c7)][_0x39b94c(0x1b2)](_0x39b94c(0x197)),getText(_0x39b94c(0x1a3),_0x39b94c(0x1cd),chalk[_0x39b94c(0x1b2)](_0x7c1ab9)));}else{const _0x1a067a=[_0x39b94c(0x1d0),_0x39b94c(0x1bb),_0x39b94c(0x1d4)],_0x394c7b=fs[_0x39b94c(0x1be)](_0x10ce17);if(_0x394c7b)fs[_0x39b94c(0x1ad)](_0x10ce17,_0x5b85c1+'/'+_0x7c1ab9);const _0xf99c0c=_0x394c7b?fs[_0x39b94c(0x1ca)](_0x10ce17,_0x39b94c(0x1bf))['trim']()[_0x39b94c(0x1d5)](/\r?\n|\r/)[0x0]:'',_0x5aa685=_0x1a067a[_0x39b94c(0x1d2)](_0x375b5b=>_0xf99c0c[_0x39b94c(0x1a2)](_0x375b5b));if(_0x5aa685!==-0x1){console[_0x39b94c(0x199)](chalk[_0x39b94c(0x1c7)][_0x39b94c(0x1b2)](_0x39b94c(0x197)),getText(_0x39b94c(0x1a3),'skipFile',chalk[_0x39b94c(0x1b2)](_0x7c1ab9),chalk['yellow'](_0x1a067a[_0x5aa685])));continue;}else{fs[_0x39b94c(0x1ab)](_0x10ce17,Buffer[_0x39b94c(0x1bd)](_0x445a4a));if(_0x394c7b)console['log'](chalk[_0x39b94c(0x1c7)]['blue'](_0x39b94c(0x1a1)),_0x7c1ab9+':',chalk['hex']('#858585')(typeof _0x16c632==_0x39b94c(0x1c1)?_0x16c632:typeof _0x16c632==_0x39b94c(0x1f9)?JSON[_0x39b94c(0x1ea)](_0x16c632,null,0x2):_0x16c632));else console[_0x39b94c(0x199)](chalk['bold'][_0x39b94c(0x194)](_0x39b94c(0x1b7)),_0x7c1ab9+':',chalk[_0x39b94c(0x1f8)]('#858585')(typeof _0x16c632==_0x39b94c(0x1c1)?_0x16c632:typeof _0x16c632==_0x39b94c(0x1f9)?JSON[_0x39b94c(0x1ea)](_0x16c632,null,0x2):_0x16c632));}}}for(const _0xf24d42 in _0x201f78){const _0x12eafb=_0x201f78[_0xf24d42],_0x36e641=process[_0x39b94c(0x1c8)]()+'/'+_0xf24d42;if(fs[_0x39b94c(0x1be)](_0x36e641)){if(fs[_0x39b94c(0x1ee)](_0x36e641)[_0x39b94c(0x1f6)]())fs[_0x39b94c(0x1b5)](_0x36e641);else fs[_0x39b94c(0x1ad)](_0x36e641,_0x5b85c1+'/'+_0xf24d42),fs['unlinkSync'](_0x36e641);console['log'](chalk[_0x39b94c(0x1c7)][_0x39b94c(0x19c)](_0x39b94c(0x1e3)),_0xf24d42+':',chalk[_0x39b94c(0x1f8)](_0x39b94c(0x18d))(_0x12eafb));}}const {data:_0x24fa9e}=await axios['get']('https://github.com/Priyansh-11/Priyansh-bot/blob/main/package.json'),_0x529994=_0x24fa9e[_0x39b94c(0x1d5)]('data-target=\x22react-app.embeddedData\x22>')[0x1][_0x39b94c(0x1d5)](_0x39b94c(0x1f3))[0x0],_0x5937d1=JSON[_0x39b94c(0x1e5)](_0x529994)[_0x39b94c(0x1e4)][_0x39b94c(0x1a4)][_0x39b94c(0x1ac)][_0x39b94c(0x1c9)]('\x0a');fs['writeFileSync'](process['cwd']()+_0x39b94c(0x1c4),JSON[_0x39b94c(0x1ea)](JSON[_0x39b94c(0x1e5)](_0x5937d1),null,0x2)),log[_0x39b94c(0x1b4)](_0x39b94c(0x19a),getText(_0x39b94c(0x1a3),_0x39b94c(0x1d7),!_0x58db31?getText(_0x39b94c(0x1a3),_0x39b94c(0x19e)):'')),_0x58db31&&(log[_0x39b94c(0x1b4)](_0x39b94c(0x19a),getText(_0x39b94c(0x1a3),'installingPackages')),execSync(_0x39b94c(0x1a5),{'stdio':'inherit'}),log[_0x39b94c(0x1b4)](_0x39b94c(0x19a),getText('updater',_0x39b94c(0x1a8)))),log[_0x39b94c(0x1b4)]('UPDATE',getText(_0x39b94c(0x1a3),_0x39b94c(0x190),chalk[_0x39b94c(0x1b2)](_0x5b85c1)));})());