forked from salmanytofficial/XLICON-V2-MD
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
b010775
commit 2e6b2be
Showing
1 changed file
with
127 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,127 @@ | ||
const _0x3daa86=_0x4279;(function(_0x5691fd,_0x13a679){const _0x2f129a=_0x4279,_0xbfb236=_0x5691fd();while(!![]){try{const _0x3ed1d9=parseInt(_0x2f129a(0x65))/0x1*(parseInt(_0x2f129a(0x73))/0x2)+parseInt(_0x2f129a(0x88))/0x3*(parseInt(_0x2f129a(0x96))/0x4)+-parseInt(_0x2f129a(0x69))/0x5*(parseInt(_0x2f129a(0x95))/0x6)+-parseInt(_0x2f129a(0x8d))/0x7*(-parseInt(_0x2f129a(0x64))/0x8)+parseInt(_0x2f129a(0x99))/0x9+parseInt(_0x2f129a(0x9b))/0xa*(-parseInt(_0x2f129a(0x75))/0xb)+-parseInt(_0x2f129a(0x91))/0xc;if(_0x3ed1d9===_0x13a679)break;else _0xbfb236['push'](_0xbfb236['shift']());}catch(_0x7dc974){_0xbfb236['push'](_0xbfb236['shift']());}}}(_0x2e83,0xba293));import _0x40015c from'os';import _0x5dd74e from'express';import{spawn}from'child_process';import _0x418a10 from'path';import{createRequire}from'module';import _0x1c8846 from'fs';import{promises as _0x140b68}from'fs';import _0x16d8a4 from'chalk';import _0x3c5eee from'cfonts';const {say}=_0x3c5eee;say(_0x3daa86(0x80),{'font':_0x3daa86(0x9d),'align':_0x3daa86(0x8c),'colors':['#ff9900'],'background':_0x3daa86(0x7b),'letterSpacing':0x1,'lineHeight':0x1,'space':!![],'maxLength':'15'}),say(_0x3daa86(0x74),{'font':_0x3daa86(0xa0),'align':_0x3daa86(0x8c),'colors':[_0x3daa86(0x6a),_0x3daa86(0x87)],'background':_0x3daa86(0x7b),'letterSpacing':0x1,'lineHeight':0x1,'space':!![],'maxLength':'30'});const app=_0x5dd74e(),port=process[_0x3daa86(0x79)]['PORT']||0x1f90,basePath=new URL(import.meta[_0x3daa86(0x6d)])[_0x3daa86(0x67)],htmlDir=_0x418a10['join'](_0x418a10[_0x3daa86(0x98)](basePath),'Assets'),sendHtml=(_0x5e8df3,_0x831a69,_0x2e33fc)=>{const _0x5cc978=_0x3daa86;_0x831a69[_0x5cc978(0x9c)](_0x418a10[_0x5cc978(0x68)](htmlDir,_0x2e33fc+_0x5cc978(0x7d)));};app[_0x3daa86(0x7c)]('/',(_0x3f917b,_0x12b2d7)=>sendHtml(_0x3f917b,_0x12b2d7,_0x3daa86(0x6b))),app[_0x3daa86(0x7a)](port,()=>{const _0x318646=_0x3daa86;console['log'](_0x16d8a4[_0x318646(0x8e)](_0x318646(0x82)+port+'\x20is\x20open'));});let isRunning=![];function _0x2e83(){const _0xf0ae73=['message','40aXPeHm','sendFile','block','\x20plugins','reset','chrome','plugins','kill','1976248PmtZYT','1badAsL','version','pathname','join','620BvbpYq','red','guru','apply','url','Bot\x20will\x20restart...','yellow','argv','cyan','Error:\x20','2012042pmNTBZ','GURU-BOT-V2\x20By\x20Guru._.','3749141jllDzb','❌Exited\x20with\x20code:\x20','send','error','env','listen','transparent','get','.html','@whiskeysockets/baileys','Installed\x20','GURU\x20-\x20V2','length','Port\x20','Using\x20Baileys\x20version\x20','ipc','unhandledRejection','unwatchFile','magenta','2103xCkCeT','watchFile','exit','inherit','center','35XiNssP','green','Error\x20reading\x20plugins\x20folder:\x20','log','2994048HVwqOr','Guru.js','Exited\x20with\x20code:\x20','✔️RECEIVED\x20','61572zChbAg','3140mGhmGR','uptime','dirname','7707330UaXnRL'];_0x2e83=function(){return _0xf0ae73;};return _0x2e83();}function _0x4279(_0x275f34,_0x5c0d1d){const _0x2e8398=_0x2e83();return _0x4279=function(_0x42795a,_0x2054af){_0x42795a=_0x42795a-0x64;let _0x42f20a=_0x2e8398[_0x42795a];return _0x42f20a;},_0x4279(_0x275f34,_0x5c0d1d);}async function start(_0x733d1b){const _0x589dfc=_0x3daa86;if(isRunning)return;isRunning=!![];const _0x2cd599=new URL(import.meta[_0x589dfc(0x6d)])[_0x589dfc(0x67)],_0x314900=[_0x418a10[_0x589dfc(0x68)](_0x418a10[_0x589dfc(0x98)](_0x2cd599),_0x733d1b),...process['argv']['slice'](0x2)],_0x4d851d=spawn(process[_0x589dfc(0x70)][0x0],_0x314900,{'stdio':[_0x589dfc(0x8b),_0x589dfc(0x8b),_0x589dfc(0x8b),_0x589dfc(0x84)]});_0x4d851d['on'](_0x589dfc(0x9a),_0x4a4026=>{const _0x39b605=_0x589dfc;console[_0x39b605(0x90)](_0x16d8a4[_0x39b605(0x71)](_0x39b605(0x94)+_0x4a4026));switch(_0x4a4026){case _0x39b605(0x9f):_0x4d851d[_0x39b605(0xa2)](),isRunning=![],start[_0x39b605(0x6c)](this,arguments);break;case'uptime':_0x4d851d[_0x39b605(0x77)](process[_0x39b605(0x97)]());break;}}),_0x4d851d['on'](_0x589dfc(0x8a),_0xfadb21=>{const _0x55b072=_0x589dfc;isRunning=![],console[_0x55b072(0x78)](_0x16d8a4[_0x55b072(0x6a)](_0x55b072(0x76)+_0xfadb21));if(_0xfadb21===0x0)return;_0x1c8846[_0x55b072(0x89)](_0x314900[0x0],()=>{const _0x5831ae=_0x55b072;_0x1c8846[_0x5831ae(0x86)](_0x314900[0x0]),start(_0x5831ae(0x92));});}),_0x4d851d['on'](_0x589dfc(0x78),_0x565628=>{const _0x4ee267=_0x589dfc;console[_0x4ee267(0x78)](_0x16d8a4[_0x4ee267(0x6a)](_0x4ee267(0x72)+_0x565628)),_0x4d851d['kill'](),isRunning=![],start('Guru.js');});const _0x590b3f=_0x418a10[_0x589dfc(0x68)](_0x418a10['dirname'](_0x2cd599),_0x589dfc(0xa1));_0x1c8846['readdir'](_0x590b3f,async(_0x295a55,_0x1f00fa)=>{const _0x51ab20=_0x589dfc;if(_0x295a55){console[_0x51ab20(0x78)](_0x16d8a4[_0x51ab20(0x6a)](_0x51ab20(0x8f)+_0x295a55));return;}console[_0x51ab20(0x90)](_0x16d8a4[_0x51ab20(0x6f)](_0x51ab20(0x7f)+_0x1f00fa[_0x51ab20(0x81)]+_0x51ab20(0x9e)));try{const {default:_0x2d151e}=await import(_0x51ab20(0x7e)),_0xa1acdf=(await _0x2d151e['fetchLatestBaileysVersion']())[_0x51ab20(0x66)];console['log'](_0x16d8a4[_0x51ab20(0x6f)](_0x51ab20(0x83)+_0xa1acdf));}catch(_0x48bf64){console['error'](_0x16d8a4['red']('\x20Baileys\x20library\x20is\x20not\x20installed'));}});}start('Guru.js'),process['on'](_0x3daa86(0x85),()=>{const _0x651034=_0x3daa86;console['error'](_0x16d8a4['red']('Unhandled\x20promise\x20rejection.\x20Bot\x20will\x20restart...')),start(_0x651034(0x92));}),process['on'](_0x3daa86(0x8a),_0x1d6264=>{const _0x2f8c40=_0x3daa86;console[_0x2f8c40(0x78)](_0x16d8a4['red'](_0x2f8c40(0x93)+_0x1d6264)),console[_0x2f8c40(0x78)](_0x16d8a4[_0x2f8c40(0x6a)](_0x2f8c40(0x6e))),start(_0x2f8c40(0x92));}); | ||
'use strict'; | ||
|
||
import os from 'os'; | ||
import express from 'express'; | ||
import { spawn } from 'child_process'; | ||
import path from 'path'; | ||
import module from 'module'; | ||
import fs from 'fs'; | ||
import fsModule from 'fs'; | ||
import chalk from 'chalk'; | ||
import cfonts from 'cfonts'; | ||
|
||
const { say } = cfonts; | ||
|
||
say("XLICON - V2", { | ||
'font': "block", | ||
'align': "center", | ||
'colors': ['#ff9900'], | ||
'background': "transparent", | ||
'letterSpacing': 0x1, | ||
'lineHeight': 0x1, | ||
'space': true, | ||
'maxLength': '15' | ||
}); | ||
|
||
say("Xlicon-BOT-V2 By Salman._.", { | ||
'font': "chrome", | ||
'align': "center", | ||
'colors': ["red", "magenta"], | ||
'background': "transparent", | ||
'letterSpacing': 0x1, | ||
'lineHeight': 0x1, | ||
'space': true, | ||
'maxLength': '30' | ||
}); | ||
|
||
const app = express(); | ||
const port = process.env.PORT || 0x1f90; | ||
const basePath = new URL(import.meta.url).pathname; | ||
const htmlDir = path.join(path.dirname(basePath), 'Assets'); | ||
|
||
const sendHtml = (res, req, page) => { | ||
req.sendFile(path.join(htmlDir, page + ".html")); | ||
}; | ||
|
||
app.get('/', (req, res) => sendHtml(res, req, "guru")); | ||
|
||
app.listen(port, () => { | ||
console.log(chalk.green("Port " + port + " is open")); | ||
}); | ||
|
||
let isRunning = false; | ||
|
||
async function start(scriptName) { | ||
if (isRunning) { | ||
return; | ||
} | ||
isRunning = true; | ||
const currentScriptPath = new URL(import.meta.url).pathname; | ||
const scriptArgs = [path.join(path.dirname(currentScriptPath), scriptName), ...process.argv.slice(0x2)]; | ||
const childProcess = spawn(process.argv[0x0], scriptArgs, { | ||
'stdio': ["inherit", "inherit", "inherit", "ipc"] | ||
}); | ||
|
||
childProcess.on("message", msg => { | ||
console.log(chalk.cyan("✔️RECEIVED " + msg)); | ||
switch (msg) { | ||
case "reset": | ||
childProcess.kill(); | ||
isRunning = false; | ||
start.apply(this, arguments); | ||
break; | ||
case 'uptime': | ||
childProcess.send(process.uptime()); | ||
break; | ||
} | ||
}); | ||
|
||
childProcess.on("exit", exitCode => { | ||
isRunning = false; | ||
console.error(chalk.red("❌Exited with code: " + exitCode)); | ||
if (exitCode === 0x0) { | ||
return; | ||
} | ||
fs.watchFile(scriptArgs[0x0], () => { | ||
fs.unwatchFile(scriptArgs[0x0]); | ||
start("Guru.js"); | ||
}); | ||
}); | ||
|
||
childProcess.on("error", err => { | ||
console.error(chalk.red("Error: " + err)); | ||
childProcess.kill(); | ||
isRunning = false; | ||
start('Guru.js'); | ||
}); | ||
|
||
const pluginsDir = path.join(path.dirname(currentScriptPath), "plugins"); | ||
|
||
fs.readdir(pluginsDir, async (err, files) => { | ||
if (err) { | ||
console.error(chalk.red("Error reading plugins folder: " + err)); | ||
return; | ||
} | ||
console.log(chalk.yellow("Installed " + files.length + " plugins")); | ||
try { | ||
const { default: baileys } = await import("@whiskeysockets/baileys"); | ||
const latestBaileysVersion = (await baileys.fetchLatestBaileysVersion()).version; | ||
console.log(chalk.yellow("Using Baileys version " + latestBaileysVersion)); | ||
} catch (err) { | ||
console.error(chalk.red(" Baileys library is not installed")); | ||
} | ||
}); | ||
} | ||
|
||
start('Guru.js'); | ||
|
||
process.on("unhandledRejection", () => { | ||
console.error(chalk.red("Unhandled promise rejection. Bot will restart...")); | ||
start("Guru.js"); | ||
}); | ||
|
||
process.on("exit", exitCode => { | ||
console.error(chalk.red("Exited with code: " + exitCode)); | ||
console.error(chalk.red("Bot will restart...")); | ||
start("Guru.js"); | ||
}); |