@bastion/tesseract
Version:
The heart and soul of the Bastion bot.
1 lines • 14.7 kB
JavaScript
const a0_0x317a74=a0_0xb5dc;(function(_0x4ba69f,_0x44350d){const _0x74ae35=a0_0xb5dc,_0x81f6d9=_0x4ba69f();while(!![]){try{const _0x42e9c1=parseInt(_0x74ae35(0x25c))/0x1+-parseInt(_0x74ae35(0x208))/0x2+parseInt(_0x74ae35(0x254))/0x3*(-parseInt(_0x74ae35(0x21a))/0x4)+-parseInt(_0x74ae35(0x1e9))/0x5*(parseInt(_0x74ae35(0x20b))/0x6)+parseInt(_0x74ae35(0x247))/0x7+parseInt(_0x74ae35(0x24a))/0x8*(parseInt(_0x74ae35(0x235))/0x9)+parseInt(_0x74ae35(0x220))/0xa*(parseInt(_0x74ae35(0x21b))/0xb);if(_0x42e9c1===_0x44350d)break;else _0x81f6d9['push'](_0x81f6d9['shift']());}catch(_0x55b7fb){_0x81f6d9['push'](_0x81f6d9['shift']());}}}(a0_0x107e,0x9bb95));const a0_0x48dcce=(function(){let _0x8da746=!![];return function(_0x2c96e2,_0x2fabde){const _0x5e241b=_0x8da746?function(){const _0x5d8fd2=a0_0xb5dc;if(_0x2fabde){const _0x16e621=_0x2fabde[_0x5d8fd2(0x1e6)](_0x2c96e2,arguments);return _0x2fabde=null,_0x16e621;}}:function(){};return _0x8da746=![],_0x5e241b;};}()),a0_0x199646=a0_0x48dcce(this,function(){const _0x121aee=a0_0xb5dc;return a0_0x199646['toString']()['search'](_0x121aee(0x24d))[_0x121aee(0x20c)]()[_0x121aee(0x1e2)](a0_0x199646)[_0x121aee(0x228)]('(((.+)+)+)+$');});a0_0x199646();import a0_0x198766 from'node:fs';import a0_0x49a836 from'node:path';import a0_0x3b8217 from'node:url';import a0_0x14394b from'mongoose';import{Client,Collection,Events,Team}from'discord.js';import{Locke}from'@iamtraction/locke';import{CronJob}from'cron';import a0_0x147f30 from'./TesseractLogger.js';import a0_0xaaf78d from'./TesseractSettings.js';function a0_0xb5dc(_0x371d11,_0x3afb09){const _0x16c4c8=a0_0x107e();return a0_0xb5dc=function(_0x199646,_0x48dcce){_0x199646=_0x199646-0x1e2;let _0x107e98=_0x16c4c8[_0x199646];return _0x107e98;},a0_0xb5dc(_0x371d11,_0x3afb09);}function a0_0x107e(){const _0x1e2f5c=['setInterval','mongoURI','This\x20command\x20can\x20only\x20be\x20used\x20if\x20unsafe\x20mode\x20is\x20enabled\x20before\x20boot.','messageComponents','584950uPvRms','I\x20don\x27t\x20have\x20permission\x20to\x20use\x20this\x20command.','cronTime','guild','settings','url','constructor','applyFilters','permissions','owners','apply','length','memberPermissions','75665JeaBGB','has','initFilters','split','initListeners','directory','base64','status','266290969974931457','destroy','error','delete','size','random','user','commandName','This\x20command\x20can\x20only\x20be\x20used\x20in\x20a\x20server.','loadCommands','tesseractSettings','exitCode','clientPermissions','unsafe','deferUpdate','MessageUpdate','filters','getSubcommandGroup','reply','dist','href','command','You\x20don\x27t\x20have\x20the\x20permissions\x20to\x20use\x20this\x20command.','860142XTODYN','group','set','66mfEbHs','toString','name','filter','presences','commands','exec','.js','isChatInputCommand','token','InteractionCreate','enabled','This\x20command\x20is\x20disabled\x20and\x20cannot\x20be\x20used\x20at\x20this\x20time.','userPermissions','isAnySelectMenu','60220qBjsHB','726EgBWJz','push','initSchedulers','login','members','95860aRYPoU','components','owner','This\x20command\x20can\x20only\x20be\x20used\x20by\x20the\x20bot\x20owner.','catch','partial','schedulers','isContextMenuCommand','search','existsSync','fetch','disconnectMongo','unsafeMode','includes','find','once','exit','isButton','values','close','stderr','4808817vbBAKm','channel','studio','connectMongo','connection','dirname','pathToFileURL','initInteractions','getSubcommand','\x0a\x0a\x0a','inCachedGuild','Tesseract','relative','app','from','options','endsWith','sep','2805565fgDgfh','isOnce','locales','8txNSCS','RkFUQUwgRVJST1I6IDB4QkFBREIwMDIKCkdvIHRvIHlvdXIgQm90J3MgYXBwbGljYXRpb24gcGFnZSBpbiBEaXNjb3JkIERldmVsb3BlcnMgc2l0ZSBhbmQgZGlzYWJsZSB0aGUgIlB1YmxpYyBCb3QiIG9wdGlvbi4KClBsZWFzZSBjb250YWN0IHRoZSBzdXBwb3J0IHRlYW0gYXQgQmFzdGlvbiBIUSAtIGh0dHBzOi8vZGlzY29yZC5nZy9meng4Zmt0IC0gZm9yIG1vcmUgaW5mb3JtYXRpb24u','267035345537728512','(((.+)+)+)+$','floor','activity','resolve','utf-8','nsfw','loadMessageComponents','183PItoLr','connect','init','shard'];a0_0x107e=function(){return _0x1e2f5c;};return a0_0x107e();}import a0_0x1be926 from'./utils/walkDirectory.js';import a0_0x24a3e0 from'./utils/isConstructor.js';class TesseractClient extends Client{[a0_0x317a74(0x242)];[a0_0x317a74(0x249)];[a0_0x317a74(0x1ee)];[a0_0x317a74(0x201)];['commands'];['messageComponents'];['settings'];['studio'];constructor(_0x41ab4f){const _0x4fe8e3=a0_0x317a74;super(_0x41ab4f),this[_0x4fe8e3(0x1ee)]=_0x4fe8e3(0x204),this[_0x4fe8e3(0x201)]=new Collection(),this[_0x4fe8e3(0x237)]=new WeakMap(),this['commands']=[],this['messageComponents']=[],this[_0x4fe8e3(0x249)]=new Locke(),this[_0x4fe8e3(0x260)]=_0x41ab4f?.['tesseractSettings']instanceof a0_0xaaf78d?_0x41ab4f[_0x4fe8e3(0x1fb)]:new a0_0xaaf78d(),setInterval(async()=>{const _0x3c2811=_0x4fe8e3;if(this[_0x3c2811(0x1f7)]['id']===_0x3c2811(0x24c))return;if(this[_0x3c2811(0x242)]){this[_0x3c2811(0x242)]=await this['application'][_0x3c2811(0x22a)]()[_0x3c2811(0x224)](a0_0x147f30[_0x3c2811(0x1f3)]);if(!this[_0x3c2811(0x242)])return;const _0x263425=this['app']?.[_0x3c2811(0x222)]instanceof Team?this['app']?.[_0x3c2811(0x222)]?.[_0x3c2811(0x222)]?.[_0x3c2811(0x1f7)]:this[_0x3c2811(0x242)]?.[_0x3c2811(0x222)];if(_0x263425?.['id']===_0x3c2811(0x1f1))return;this[_0x3c2811(0x242)]?.['botPublic']&&(process[_0x3c2811(0x234)]['write']('\x0a\x0a'+Buffer[_0x3c2811(0x243)](_0x3c2811(0x24b),_0x3c2811(0x1ef))[_0x3c2811(0x20c)](_0x3c2811(0x251))+_0x3c2811(0x23e)),this[_0x3c2811(0x257)]?await this['shard']['broadcastEval'](_0x550fe6=>{const _0x166f93=_0x3c2811;_0x550fe6[_0x166f93(0x1f2)](),process[_0x166f93(0x1fc)]=0xbaadb002;})[_0x3c2811(0x224)](a0_0x147f30['error']):(this['destroy'](),process['exitCode']=0xbaadb002,process[_0x3c2811(0x230)](0xbaadb002)));}},0x2bf20);}['setInterval'](_0x3eba24,_0xd30293){_0x3eba24(),setTimeout(()=>this['setInterval'](_0x3eba24,_0xd30293),_0xd30293)['unref']();}[a0_0x317a74(0x1e3)]=async _0x1e4c50=>{const _0x397d4f=a0_0x317a74;if(this[_0x397d4f(0x201)][_0x397d4f(0x1f5)]===0x0)return;let _0x6df4d4=![];if(_0x1e4c50[_0x397d4f(0x225)])await _0x1e4c50[_0x397d4f(0x22a)]();for(const _0x4bd800 of this[_0x397d4f(0x201)][_0x397d4f(0x232)]()){_0x6df4d4=await _0x4bd800[_0x397d4f(0x211)](_0x1e4c50);if(_0x6df4d4&&_0x1e4c50['deletable']){await _0x1e4c50[_0x397d4f(0x1f4)]();break;}}};[a0_0x317a74(0x1fa)]=async _0x349ea2=>{const _0x1d3019=a0_0x317a74,_0x37ceda=a0_0x49a836['resolve'](this['directory'],_0x349ea2);if(a0_0x198766[_0x1d3019(0x229)](_0x37ceda)){const _0x5ab5f5=a0_0x1be926(_0x37ceda);for(const _0x45fb45 of _0x5ab5f5[_0x1d3019(0x20e)](_0x106cf8=>_0x106cf8[_0x1d3019(0x245)]('.js'))){const {Command:_0x374c0a}=await import(a0_0x3b8217[_0x1d3019(0x23b)](_0x45fb45)[_0x1d3019(0x205)]);if(a0_0x24a3e0(_0x374c0a)){const _0x4dd066=new _0x374c0a(),[_0x28751a,_0x23f281]=a0_0x49a836[_0x1d3019(0x241)](_0x37ceda,a0_0x49a836[_0x1d3019(0x23a)](_0x45fb45))[_0x1d3019(0x1ec)](a0_0x49a836[_0x1d3019(0x246)]);_0x4dd066[_0x1d3019(0x209)]=_0x23f281?_0x28751a+'.'+_0x23f281:_0x28751a?_0x28751a:undefined,this[_0x1d3019(0x210)]['push'](_0x4dd066);}}}};[a0_0x317a74(0x253)]=async()=>{const _0x3a80f1=a0_0x317a74,_0x331188=a0_0x49a836['resolve'](this[_0x3a80f1(0x1ee)],_0x3a80f1(0x221));if(a0_0x198766[_0x3a80f1(0x229)](_0x331188)){const _0x28d3b3=a0_0x1be926(_0x331188);for(const _0x29960d of _0x28d3b3['filter'](_0x3a067c=>_0x3a067c['endsWith'](_0x3a80f1(0x212)))){const {MessageComponent:_0x13aa38}=await import(a0_0x3b8217['pathToFileURL'](_0x29960d)[_0x3a80f1(0x205)]);if(a0_0x24a3e0(_0x13aa38)){const _0x1c832b=new _0x13aa38();this['messageComponents'][_0x3a80f1(0x21c)](_0x1c832b);}}}};[a0_0x317a74(0x23c)]=async()=>{const _0x5bfe4e=a0_0x317a74;await this[_0x5bfe4e(0x1fa)]('actions'),await this['loadCommands'](_0x5bfe4e(0x210)),await this[_0x5bfe4e(0x253)](),this['on'](Events[_0x5bfe4e(0x215)],async _0x54733f=>{const _0x9582c2=_0x5bfe4e;try{if(_0x54733f[_0x9582c2(0x213)]()){const _0x5d1d01=_0x54733f[_0x9582c2(0x244)][_0x9582c2(0x23d)](![]),_0x47db48=_0x54733f['options'][_0x9582c2(0x202)](![]),_0x318afb=_0x5d1d01?this[_0x9582c2(0x210)][_0x9582c2(0x20e)](_0xb9e0d1=>_0xb9e0d1[_0x9582c2(0x209)]===(_0x47db48?_0x54733f[_0x9582c2(0x1f8)]+'.'+_0x47db48:_0x54733f[_0x9582c2(0x1f8)])):this['commands'],_0x4a28c9=_0x318afb['find'](_0x37f29f=>_0x37f29f['name']===(_0x5d1d01||_0x54733f[_0x9582c2(0x1f8)]));if(_0x4a28c9){if(!_0x54733f[_0x9582c2(0x23f)]())return _0x54733f[_0x9582c2(0x203)]({'content':_0x9582c2(0x1f9),'ephemeral':!![]});a0_0x147f30['command'](_0x54733f);if(!_0x4a28c9['enabled'])return _0x54733f['reply']({'content':_0x9582c2(0x217),'ephemeral':!![]});if(_0x4a28c9['owner']&&!this['settings'][_0x9582c2(0x1e5)]?.[_0x9582c2(0x22d)](_0x54733f[_0x9582c2(0x1f7)]['id']))return _0x54733f['reply']({'content':_0x9582c2(0x223),'ephemeral':!![]});if(!_0x54733f[_0x9582c2(0x25f)][_0x9582c2(0x21f)]['me'][_0x9582c2(0x1e4)][_0x9582c2(0x1ea)](_0x4a28c9[_0x9582c2(0x1fd)]))return _0x54733f[_0x9582c2(0x203)]({'content':'I\x20don\x27t\x20have\x20permission\x20to\x20use\x20this\x20command.','ephemeral':!![]});if(!_0x54733f[_0x9582c2(0x1e8)][_0x9582c2(0x1ea)](_0x4a28c9[_0x9582c2(0x218)]))return _0x54733f[_0x9582c2(0x203)]({'content':_0x9582c2(0x207),'ephemeral':!![]});if(_0x4a28c9[_0x9582c2(0x1fe)]&&!this[_0x9582c2(0x260)][_0x9582c2(0x22c)])return _0x54733f[_0x9582c2(0x203)]({'content':_0x9582c2(0x25a),'ephemeral':!![]});if(_0x4a28c9[_0x9582c2(0x252)]&&!_0x54733f[_0x9582c2(0x236)][_0x9582c2(0x252)])return _0x54733f[_0x9582c2(0x203)]({'content':'You\x20can\x20only\x20use\x20this\x20command\x20in\x20NSFW\x20channels.','ephemeral':!![]});return _0x4a28c9[_0x9582c2(0x211)](_0x54733f);}}if(_0x54733f[_0x9582c2(0x227)]()){const _0x3804ab=this[_0x9582c2(0x210)][_0x9582c2(0x22e)](_0x3a0509=>_0x3a0509[_0x9582c2(0x20d)]===_0x54733f[_0x9582c2(0x1f8)]);if(_0x3804ab){if(!_0x54733f[_0x9582c2(0x23f)]())return _0x54733f[_0x9582c2(0x203)]({'content':_0x9582c2(0x1f9),'ephemeral':!![]});a0_0x147f30[_0x9582c2(0x206)](_0x54733f);if(!_0x3804ab[_0x9582c2(0x216)])return _0x54733f['reply']({'content':_0x9582c2(0x217),'ephemeral':!![]});if(_0x3804ab[_0x9582c2(0x222)]&&!this[_0x9582c2(0x260)][_0x9582c2(0x1e5)]?.[_0x9582c2(0x22d)](_0x54733f['user']['id']))return _0x54733f[_0x9582c2(0x203)]({'content':'This\x20command\x20can\x20only\x20be\x20used\x20by\x20the\x20bot\x20owner.','ephemeral':!![]});if(!_0x54733f[_0x9582c2(0x25f)]['members']['me'][_0x9582c2(0x1e4)][_0x9582c2(0x1ea)](_0x3804ab[_0x9582c2(0x1fd)]))return _0x54733f['reply']({'content':_0x9582c2(0x25d),'ephemeral':!![]});if(!_0x54733f[_0x9582c2(0x1e8)]['has'](_0x3804ab[_0x9582c2(0x218)]))return _0x54733f[_0x9582c2(0x203)]({'content':_0x9582c2(0x207),'ephemeral':!![]});return _0x3804ab['exec'](_0x54733f);}}if(_0x54733f[_0x9582c2(0x231)]()||_0x54733f['isModalSubmit']()||_0x54733f[_0x9582c2(0x219)]()){const [_0x177545]=_0x54733f['customId'][_0x9582c2(0x1ec)](':'),_0x2c1bf1=this[_0x9582c2(0x25b)]['find'](_0x2c2328=>_0x2c2328['id']===_0x177545);if(_0x2c1bf1){if(!_0x54733f['inCachedGuild']())return;if(_0x2c1bf1[_0x9582c2(0x222)]&&!this[_0x9582c2(0x260)][_0x9582c2(0x1e5)]?.[_0x9582c2(0x22d)](_0x54733f[_0x9582c2(0x1f7)]['id']))return _0x54733f['deferUpdate']();if(!_0x54733f['memberPermissions'][_0x9582c2(0x1ea)](_0x2c1bf1[_0x9582c2(0x218)]))return _0x54733f[_0x9582c2(0x1ff)]();return _0x2c1bf1[_0x9582c2(0x211)](_0x54733f);}}return Promise['resolve'](undefined);}catch(_0x659a70){a0_0x147f30['error'](_0x659a70);}});};['initFilters']=async()=>{const _0x3c664c=a0_0x317a74,_0xb9098b=a0_0x49a836[_0x3c664c(0x250)](this['directory'],_0x3c664c(0x201));if(a0_0x198766['existsSync'](_0xb9098b)){const _0x216374=a0_0x1be926(_0xb9098b);for(const _0x53d953 of _0x216374[_0x3c664c(0x20e)](_0x332890=>_0x332890[_0x3c664c(0x245)](_0x3c664c(0x212)))){const {Filter:_0x40f2ad}=await import(a0_0x3b8217[_0x3c664c(0x23b)](_0x53d953)[_0x3c664c(0x205)]);if(a0_0x24a3e0(_0x40f2ad)){const _0x5b674c=new _0x40f2ad();this[_0x3c664c(0x201)][_0x3c664c(0x20a)](_0x5b674c[_0x3c664c(0x20d)],_0x5b674c);}}}this['on'](Events['MessageCreate'],async _0x430321=>this[_0x3c664c(0x1e3)](_0x430321)),this['on'](Events[_0x3c664c(0x200)],async(_0x1f50ba,_0x235ffa)=>this[_0x3c664c(0x1e3)](_0x235ffa));};[a0_0x317a74(0x1ed)]=async()=>{const _0x4f5dfc=a0_0x317a74,_0x5a2113=a0_0x49a836[_0x4f5dfc(0x250)](this[_0x4f5dfc(0x1ee)],'listeners');if(a0_0x198766[_0x4f5dfc(0x229)](_0x5a2113)){const _0x1abe3c=a0_0x1be926(_0x5a2113);for(const _0x14eed3 of _0x1abe3c['filter'](_0x482f9c=>_0x482f9c[_0x4f5dfc(0x245)](_0x4f5dfc(0x212)))){const {Listener:_0x385861}=await import(a0_0x3b8217[_0x4f5dfc(0x23b)](_0x14eed3)[_0x4f5dfc(0x205)]);if(a0_0x24a3e0(_0x385861)){const _0x185efc=new _0x385861();this[_0x185efc[_0x4f5dfc(0x248)]?_0x4f5dfc(0x22f):'on'](_0x185efc[_0x4f5dfc(0x20d)],async(..._0x1973d8)=>{const _0x6e68ef=_0x4f5dfc;try{await _0x185efc[_0x6e68ef(0x211)](..._0x1973d8);}catch(_0x5ea878){a0_0x147f30['error'](_0x5ea878);}});}}}};[a0_0x317a74(0x21d)]=async()=>{const _0x1c237e=a0_0x317a74,_0x2bf607=a0_0x49a836['resolve'](this[_0x1c237e(0x1ee)],_0x1c237e(0x226));if(a0_0x198766[_0x1c237e(0x229)](_0x2bf607)){const _0x1ac793=a0_0x1be926(_0x2bf607);for(const _0x2005c5 of _0x1ac793[_0x1c237e(0x20e)](_0x2c489c=>_0x2c489c['endsWith'](_0x1c237e(0x212)))){const {Scheduler:_0x5a9fa1}=await import(a0_0x3b8217[_0x1c237e(0x23b)](_0x2005c5)['href']);if(a0_0x24a3e0(_0x5a9fa1)){const _0x5e670a=new _0x5a9fa1();_0x5e670a['client']=this,CronJob[_0x1c237e(0x243)]({'cronTime':_0x5e670a[_0x1c237e(0x25e)],'onTick':_0x5e670a[_0x1c237e(0x211)],'context':_0x5e670a,'start':!![],'unrefTimeout':!![]});}}}};['connectMongo']=()=>a0_0x14394b[a0_0x317a74(0x255)](this['settings'][a0_0x317a74(0x259)]);[a0_0x317a74(0x22b)]=()=>a0_0x14394b[a0_0x317a74(0x239)][a0_0x317a74(0x233)]();async[a0_0x317a74(0x256)](){const _0x22a904=a0_0x317a74;await this[_0x22a904(0x238)](),await this[_0x22a904(0x23c)](),await this[_0x22a904(0x1eb)](),await this[_0x22a904(0x1ed)](),await this['initSchedulers']();const _0xa8d49f=await this[_0x22a904(0x21e)](this[_0x22a904(0x260)][_0x22a904(0x214)]);return this[_0x22a904(0x258)](()=>{const _0xdb1fce=_0x22a904;if(this[_0xdb1fce(0x260)]?.[_0xdb1fce(0x20f)]instanceof Array&&this[_0xdb1fce(0x260)][_0xdb1fce(0x20f)][_0xdb1fce(0x1e7)]){const _0x560bcd=this[_0xdb1fce(0x260)][_0xdb1fce(0x20f)][Math[_0xdb1fce(0x24e)](Math[_0xdb1fce(0x1f6)]()*this['settings'][_0xdb1fce(0x20f)][_0xdb1fce(0x1e7)])];this[_0xdb1fce(0x1f7)]['presence'][_0xdb1fce(0x20a)]({'status':_0x560bcd?.[_0xdb1fce(0x1f0)],'activities':[{'name':_0x560bcd?.[_0xdb1fce(0x20d)],'type':_0x560bcd?.[_0xdb1fce(0x24f)],'url':_0x560bcd?.[_0xdb1fce(0x261)]}]});}},0x2255100),_0xa8d49f;}[a0_0x317a74(0x20c)]=()=>a0_0x317a74(0x240);}export default TesseractClient;