-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathheroku.js
89 lines (64 loc) · 2.35 KB
/
heroku.js
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
78
79
80
81
82
83
84
85
86
87
88
const { zokou } = require('../framework/zokou');
const s = require('../set')
zokou(
{
nomCom : "setvar",
categorie : "heroku"
}, async (dest , zk , commandeOptions) =>{
const {ms,repondre,superUser , arg} = commandeOptions ;
if(!superUser){repondre('only Mods can use this commande');return};
if(!arg[0] || !(arg.join('').split('='))) {repondre('Bad format ; Exemple of using :\nSetvar OWNER_NAME=Ibrahim Adams');return};
const text = arg.join(" ")
const Heroku = require("heroku-client");
const heroku = new Heroku({
token: s.HEROKU_APY_KEY,
});
let baseURI = "/apps/" + s.HEROKU_APP_NAME;
await heroku.patch(baseURI + "/config-vars", {
body: {
[text.split('=')[0]]: text.split('=')[1],
},
});
await repondre('Heroku var changes , rebootings....')
}
);
zokou(
{
nomCom : "allvar",
categorie : "heroku"
}, async (dest , zk , commandeOptions) =>{
const {ms,repondre,superUser , arg} = commandeOptions ;
if(!superUser){repondre('only mods can use this commande');return};
const Heroku = require("heroku-client");
const heroku = new Heroku({
token: s.HEROKU_APY_KEY,
});
let baseURI = "/apps/" + s.HEROKU_APP_NAME;
let h = await heroku.get(baseURI+'/config-vars')
let str = '*BMW WABOT VARS*\n\n'
for (vr in h) {
str+= '🚘 *'+vr+'* '+'= '+h[vr]+'\n'
}
repondre(str)
}
);
zokou(
{
nomCom : "getvar",
categorie : "heroku"
}, async (dest , zk , commandeOptions) =>{
const {ms,repondre,superUser , arg} = commandeOptions ;
if(!superUser){repondre('Only Mods can use this command');return};
if(!arg[0]) {repondre('insert the variable name in capital letter'); return} ;
try {
const Heroku = require("heroku-client");
const heroku = new Heroku({
token: s.HEROKU_APY_KEY,
});
let baseURI = "/apps/" + s.HEROKU_APP_NAME;
let h = await heroku.get(baseURI+'/config-vars')
for (vr in h) {
if( arg.join(' ') ===vr ) return repondre( vr+'= '+h[vr]) ;
}
} catch(e) {repondre('Error' + e)}
});