Fearless001 commited on
Commit
00a06f9
·
verified ·
1 Parent(s): e22d32c

Delete silva.js

Browse files
Files changed (1) hide show
  1. silva.js +0 -131
silva.js DELETED
@@ -1,131 +0,0 @@
1
- import chalk from 'chalk'
2
- import { spawn } from 'child_process'
3
- import express from 'express'
4
- import figlet from 'figlet'
5
- import fs from 'fs'
6
- import path from 'path'
7
- import { fileURLToPath } from 'url';
8
-
9
- figlet(
10
- 'SILVA MD',
11
- {
12
- font: 'Ghost',
13
- horizontalLayout: 'default',
14
- verticalLayout: 'default',
15
- },
16
- (err, data) => {
17
- if (err) {
18
- console.error(chalk.red('Figlet error:', err))
19
- return
20
- }
21
- console.log(chalk.yellow(data))
22
- }
23
- )
24
-
25
- figlet(
26
- 'Silva Bot',
27
- {
28
- horizontalLayout: 'default',
29
- verticalLayout: 'default',
30
- },
31
- (err, data) => {
32
- if (err) {
33
- console.error(chalk.red('Figlet error:', err))
34
- return
35
- }
36
- console.log(chalk.magenta(data))
37
- }
38
- )
39
-
40
- const app = express()
41
- const port = process.env.PORT || 5000
42
-
43
- const __filename = fileURLToPath(import.meta.url);
44
- const __dirname = path.dirname(__filename);
45
-
46
- app.use(express.static(path.join(__dirname, 'jusorts')));
47
-
48
- app.get('/', (req, res) => {
49
- res.redirect('/silva.html');
50
- });
51
-
52
- app.listen(port, () => {
53
- console.log(chalk.green(`Port ${port} is open`))
54
- })
55
-
56
- let isRunning = false
57
-
58
- async function start(file) {
59
- if (isRunning) return
60
- isRunning = true
61
-
62
- const currentFilePath = new URL(import.meta.url).pathname
63
- const args = [path.join(path.dirname(currentFilePath), file), ...process.argv.slice(2)]
64
- const p = spawn(process.argv[0], args, {
65
- stdio: ['inherit', 'inherit', 'inherit', 'ipc'],
66
- })
67
-
68
- p.on('message', data => {
69
- console.log(chalk.cyan(`✔️RECEIVED ${data}`))
70
- switch (data) {
71
- case 'reset':
72
- p.kill()
73
- isRunning = false
74
- start.apply(this, arguments)
75
- break
76
- case 'uptime':
77
- p.send(process.uptime())
78
- break
79
- }
80
- })
81
-
82
- p.on('exit', code => {
83
- isRunning = false
84
- console.error(chalk.red(`❌Exited with code: ${code}`))
85
-
86
- if (code === 0) return
87
-
88
- fs.watchFile(args[0], () => {
89
- fs.unwatchFile(args[0])
90
- start('sylivanus.js')
91
- })
92
- })
93
-
94
- p.on('error', err => {
95
- console.error(chalk.red(`Error: ${err}`))
96
- p.kill()
97
- isRunning = false
98
- start('sylivanus.js')
99
- })
100
-
101
- const pluginsFolder = path.join(path.dirname(currentFilePath), 'lazackcmds')
102
-
103
- fs.readdir(pluginsFolder, async (err, files) => {
104
- if (err) {
105
- console.error(chalk.red(`Error reading lazackcmds folder: ${err}`))
106
- return
107
- }
108
- console.log(chalk.yellow(`Installed ${files.length} plugins`))
109
-
110
- try {
111
- const { default: baileys } = await import('@whiskeysockets/baileys')
112
- const version = (await baileys.fetchLatestBaileysVersion()).version
113
- console.log(chalk.yellow(`Using Baileys version ${version}`))
114
- } catch (e) {
115
- console.error(chalk.red(' Baileys library is not installed'))
116
- }
117
- })
118
- }
119
-
120
- start('sylivanus.js')
121
-
122
- process.on('unhandledRejection', () => {
123
- console.error(chalk.red(`Unhandled promise rejection. Bot will restart...`))
124
- start('sylivanus.js')
125
- })
126
-
127
- process.on('exit', code => {
128
- console.error(chalk.red(`Exited with code: ${code}`))
129
- console.error(chalk.red(`Bot will restart...`))
130
- start('sylivanus.js')
131
- })