-
Notifications
You must be signed in to change notification settings - Fork 19
/
BackupVer
33 lines (32 loc) · 1.24 KB
/
BackupVer
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
const fs = require('fs');
const path = require('path');
const login = require('./fb-chat-api/index');
const express = require('express');
const app = express();
const chalk = require('chalk');
const bodyParser = require('body-parser');
const script = path.join(__dirname, 'script');
const cron = require('node-cron');
const config = fs.existsSync('./data') && fs.existsSync('./data/config.json') ? JSON.parse(fs.readFileSync('./data/config.json', 'utf8')) : createConfig();
const Utils = new Object({
commands: new Map(),
handleEvent: new Map(),
account: new Map(),
cooldowns: new Map(),
});
fs.readdirSync(script).forEach((file) => {
const scripts = path.join(script, file);
const stats = fs.statSync(scripts);
if (stats.isDirectory()) {
fs.readdirSync(scripts).forEach((file) => {
try {
const {
config,
run,
handleEvent
} = require(path.join(scripts, file));
if (config) {
const {
name = [], role = '0', version = '1.0.0', hasPrefix = true, aliases = [], description = '', usage = '', credits = '', cooldown = '5'
} = Object.fromEntries(Object.entries(config).map(([key, value]) => [key.toLowerCase(), value]));
aliases.push(name);