-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathindex.js
58 lines (56 loc) · 1.62 KB
/
index.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
const { Plugin } = require('powercord/entities');
const { uninject, inject } = require('../../../../injectors/main');
const fs = require("fs");
const { RestClient } = require('@pxtrn/bybit-api');
const Settings = require('./components/Settings');
const App = require('./components/Settings');
module.exports = class Bycord extends Plugin {
async startPlugin () {
inject('Bycord');
powercord.api.settings.registerSettings(this.entityID, {
category: this.entityID,
label: 'Bycord',
render: Settings,
});
this.start();
}
reload () {
uninject('Bycord');
inject('Bycord');
}
pluginWillUnload () {
uninject('Bycord');
}
async start() {
const config = () => {
const imported = require("./config.json");
if(imported.aPIKey == "undefined" || imported.aPISecret == "undefined") {
return {"aPIKey":"CHANGEME","aPISecret":"CHANGEME", "currencies": ["BTC"]}
}
return imported
};
const client = new RestClient(
config.aPIKey,
config.aPISecret,
true,
);
switch(config.currencies.length) {
case(1):
client.getWalletBalance({ coin: config.currencies[0] })
.then( (result) => {
console.log(`Balance(${config.currencies[0]}) result: `, result);
})
.catch(err => {
console.error(`Balance(${config.currencies[0]}) error: `, err);
});
default:
client.getWalletBalance({ coin: "BTC" })
.then( (result) => {
console.log("Balance(BTC) result: ", result);
})
.catch(err => {
console.error("Balance(BTC) error: ", err);
});
}
}
};