forked from arskyy/Senkuu-MD
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathglobal.js
More file actions
77 lines (71 loc) · 2.28 KB
/
global.js
File metadata and controls
77 lines (71 loc) · 2.28 KB
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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
const fs = require('fs');
const { color } = require("./lib/function");
const {
isLimit:isLimit,
limitAdd:limitAdd,
getLimit:getLimit,
giveLimit:giveLimit,
addBalance:addBalance,
kurangBalance:kurangBalance,
getBalance:getBalance,
isGame:isGame,
gameAdd:gameAdd,
givegame:givegame,
cekGLimit:cekGLimit
} = require("./lib/function/functionLimit")
global.prem = require("./lib/function/premium")
global.limit = JSON.parse(fs.readFileSync("./lib/database/limit.json"))
global.glimit = JSON.parse(fs.readFileSync("./lib/database/glimit.json"))
global.balance = JSON.parse(fs.readFileSync("./lib/database/balance.json"))
global.premium = JSON.parse(fs.readFileSync("./lib/database/premium.json"))
global.isLimit = isLimit
global.limitAdd = limitAdd
global.getLimit = getLimit
global.giveLimit = giveLimit
global.addBalance = addBalance
global.kurangBalance = kurangBalance
global.getBalance = getBalance
global.isGame = isGame
global.gameAdd = gameAdd
global.givegame = givegame
global.cekGLimit = cekGLimit;
global.shp = " ×"
global.config = require("./lib/config.json");
global.sc = require('./lib/scrape');
global.tool = require('./lib/tools');
global.footer = "*_乂 Simple WhatsApp - Bot_*"
const IkyyClient = require("ikyy");
global.rzky = new IkyyClient();
const Database = require('./lib/Database')
global.db = new Database()
global.conns = []
global.printLog = async(isCmd, sender, msg, body, groupName, isGc) => {
if(isCmd && isGc) {
return console.log(color("[ COMMAND GC ]", "aqua"),color(sender.split("@")[0], "lime"),color(body, "aqua"),"in",color(groupName, "lime"));
}
if(isCmd && !isGc) {
return console.log(color("[ COMMAND PC ]", "aqua"), color(sender.split("@")[0], "lime"), color(body, "aqua"));
}
}
global.reloadFile = (file, options = {}) => {
nocache(file, module => {
console.log(`File "${file}" has updated!\nRestarting!`)
process.send("reset")
})
}
function nocache(module, cb = () => {}) {
fs.watchFile(require.resolve(module), async () => {
await uncache(require.resolve(module))
cb(module)
})
}
function uncache(module = '.') {
return new Promise((resolve, reject) => {
try {
delete require.cache[require.resolve(module)]
resolve()
} catch (e) {
reject(e)
}
})
}