💻 Sync with local
This commit is contained in:
parent
075dc25844
commit
7677ea0194
426
main.js
426
main.js
|
@ -1,426 +1,20 @@
|
|||
// SpookVooper API - main.js
|
||||
// Written by Brendan Lane - https://brndnln.dev/
|
||||
|
||||
const userURL = "https://api.spookvooper.com/user";
|
||||
const groupURL = "https://api.spookvooper.com/group";
|
||||
const ecoURL = "https://api.spookvooper.com/eco";
|
||||
const authURL = "https://spookvooper.com/oauth2";
|
||||
|
||||
const axios = require('axios');
|
||||
let urlReturn;
|
||||
|
||||
class User {
|
||||
#apikey = undefined;
|
||||
|
||||
constructor(svid) {
|
||||
this.svid = svid
|
||||
}
|
||||
|
||||
getUser() {
|
||||
return new Promise((resolve, reject) => {
|
||||
axios.get(`${userURL}/getUser?svid=${this.svid}`)
|
||||
.then(function (response) {
|
||||
resolve(response.data);
|
||||
})
|
||||
.catch(function (error) {
|
||||
reject(error);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
getUsername() {
|
||||
return new Promise((resolve, reject) => {
|
||||
axios.get(`${userURL}/getUsername?svid=${this.svid}`)
|
||||
.then(function (response) {
|
||||
resolve(response.data);
|
||||
})
|
||||
.catch(function (error) {
|
||||
reject(error);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
getBalance() {
|
||||
return new Promise((resolve, reject) => {
|
||||
axios.get(`${ecoURL}/getBalance?svid=${this.svid}`)
|
||||
.then(function (response) {
|
||||
resolve(response.data);
|
||||
})
|
||||
.catch(function (error) {
|
||||
reject(error);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
hasDiscordRole(role) {
|
||||
return new Promise((resolve, reject) => {
|
||||
axios.get(`${userURL}/hasDiscordRole?userid=${this.svid}&role=${role}`)
|
||||
.then(function (response) {
|
||||
resolve(response.data);
|
||||
})
|
||||
.catch(function (error) {
|
||||
reject(error);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
getDiscordRoles() {
|
||||
return new Promise((resolve, reject) => {
|
||||
axios.get(`${userURL}/getDiscordRoles?svid=${this.svid}`)
|
||||
.then(function (response) {
|
||||
resolve(response.data);
|
||||
})
|
||||
.catch(function (error) {
|
||||
reject(error);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
getDaysSinceLastMove() {
|
||||
return new Promise((resolve, reject) => {
|
||||
axios.get(`${userURL}/getDaysSinceLastMove?svid=${this.svid}`)
|
||||
.then(function (response) {
|
||||
resolve(response.data);
|
||||
})
|
||||
.catch(function (error) {
|
||||
reject(error);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
setApiKey(key) {
|
||||
this.#apikey = key;
|
||||
}
|
||||
|
||||
sendCredits(amount, to, reason) {
|
||||
if (typeof to === "string") {
|
||||
return new Promise((resolve, reject) => {
|
||||
axios.get(`${ecoURL}/sendTransactionByIds?from=${this.svid}&to=${to}&amount=${amount}&auth=${this.#apikey}&detail=${reason}`)
|
||||
.then(function (response) {
|
||||
resolve(response.data);
|
||||
})
|
||||
.catch(function (error) {
|
||||
reject(error);
|
||||
});
|
||||
});
|
||||
} else if (typeof to === "object") {
|
||||
return new Promise((resolve, reject) => {
|
||||
axios.get(`${ecoURL}/sendTransactionByIds?from=${this.svid}&to=${to.svid}&amount=${amount}&auth=${this.#apikey}&detail=${reason}`)
|
||||
.then(function (response) {
|
||||
resolve(response.data);
|
||||
})
|
||||
.catch(function (error) {
|
||||
reject(error);
|
||||
});
|
||||
});
|
||||
} else {
|
||||
throw "The 'to' parameter must be a string or an object!";
|
||||
}
|
||||
}
|
||||
|
||||
getUserStockOffers(ticker) {
|
||||
return new Promise((resolve, reject) => {
|
||||
axios.get(`${ecoURL}/getUserStockOffers?ticker=${ticker}&svid=${this.svid}`)
|
||||
.then(function (response) {
|
||||
resolve(response.data);
|
||||
})
|
||||
.catch(function (error) {
|
||||
reject(error);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
buyStock(ticker, amount, price) {
|
||||
return new Promise((resolve, reject) => {
|
||||
axios.get(`${ecoURL}/submitStockBuy?ticker=${ticker}&count=${amount}&price=${price}&accountid=${this.svid}&auth=${this.#apikey}`)
|
||||
.then(function (response) {
|
||||
resolve(response.data);
|
||||
})
|
||||
.catch(function (error) {
|
||||
reject(error);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
sellStock(ticker, amount, price) {
|
||||
return new Promise((resolve, reject) => {
|
||||
axios.get(`${ecoURL}/submitStockSell?ticker=${ticker}&count=${amount}&price=${price}&accountid=${this.svid}&auth=${this.#apikey}`)
|
||||
.then(function (response) {
|
||||
resolve(response.data);
|
||||
})
|
||||
.catch(function (error) {
|
||||
reject(error);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
cancelStockOrder(orderid) {
|
||||
return new Promise((resolve, reject) => {
|
||||
axios.get(`${ecoURL}/cancelOrder?orderid=${orderid}&accountid=${this.svid}&auth=${this.#apikey}`)
|
||||
.then(function (response) {
|
||||
resolve(response.data);
|
||||
})
|
||||
.catch(function (error) {
|
||||
reject(error);
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
class Stock {
|
||||
constructor(ticker) {
|
||||
this.ticker = ticker;
|
||||
}
|
||||
|
||||
getValue() {
|
||||
return new Promise((resolve, reject) => {
|
||||
axios.get(`${ecoURL}/getStockValue?ticker=${this.ticker}`)
|
||||
.then(function (response) {
|
||||
resolve(response.data);
|
||||
})
|
||||
.catch(function (error) {
|
||||
reject(error);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
getStockBuyPrice() {
|
||||
return new Promise((resolve, reject) => {
|
||||
axios.get(`${ecoURL}/getStockBuyPrice?ticker=${this.ticker}`)
|
||||
.then(function (response) {
|
||||
resolve(response.data);
|
||||
})
|
||||
.catch(function (error) {
|
||||
reject(error);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
getQueueInfo(type) {
|
||||
switch (type) {
|
||||
case "BUY":
|
||||
break;
|
||||
|
||||
case "SELL":
|
||||
break;
|
||||
|
||||
default:
|
||||
throw "Parameter 'type' must be 'BUY' or 'SELL'"
|
||||
}
|
||||
|
||||
return new Promise((resolve, reject) => {
|
||||
axios.get(`${ecoURL}/getQueueInfo?ticker=${this.ticker}&type=${type}`)
|
||||
.then(function (response) {
|
||||
resolve(response.data);
|
||||
})
|
||||
.catch(function (error) {
|
||||
reject(error);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
getOwner() {
|
||||
return new Promise((resolve, reject) => {
|
||||
axios.get(`${ecoURL}/getOwnerData?ticker=${this.ticker}`)
|
||||
.then(function (response) {
|
||||
resolve(response.data);
|
||||
})
|
||||
.catch(function (error) {
|
||||
reject(error);
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
class District {
|
||||
constructor(name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
getWealth(type) {
|
||||
switch (type) {
|
||||
case "ALL":
|
||||
return new Promise((resolve, reject) => {
|
||||
axios.get(`${ecoURL}/getDistrictWealth?id=${this.name}`)
|
||||
.then(function (response) {
|
||||
resolve(response.data);
|
||||
})
|
||||
.catch(function (error) {
|
||||
reject(error);
|
||||
});
|
||||
});
|
||||
|
||||
case "USER":
|
||||
return new Promise((resolve, reject) => {
|
||||
axios.get(`${ecoURL}/getDistrictUserWealth?id=${this.name}`)
|
||||
.then(function (response) {
|
||||
resolve(response.data);
|
||||
})
|
||||
.catch(function (error) {
|
||||
reject(error);
|
||||
});
|
||||
});
|
||||
|
||||
case "GROUP":
|
||||
return new Promise((resolve, reject) => {
|
||||
axios.get(`${ecoURL}/getDistrictGroupWealth?id=${this.name}`)
|
||||
.then(function (response) {
|
||||
resolve(response.data);
|
||||
})
|
||||
.catch(function (error) {
|
||||
reject(error);
|
||||
});
|
||||
});
|
||||
|
||||
default:
|
||||
throw "Parameter 'type' must be 'ALL', 'USER', or 'GROUP'";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class Group {
|
||||
#apikey = undefined;
|
||||
|
||||
constructor(name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
getGroup() {
|
||||
return new Promise((resolve, reject) => {
|
||||
axios.get(`${groupURL}/getGroup?svid=${this.svid}`)
|
||||
.then(function (response) {
|
||||
resolve(response.data);
|
||||
})
|
||||
.catch(function (error) {
|
||||
reject(error);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
setApiKey(key) {
|
||||
this.#apikey = key;
|
||||
}
|
||||
|
||||
sendCredits(amount, to, reason) {
|
||||
if (typeof to === "string") {
|
||||
return new Promise((resolve, reject) => {
|
||||
axios.get(`${ecoURL}/sendTransactionByIds?from=${this.svid}&to=${to}&amount=${amount}&auth=${this.#apikey}&detail=${reason}`)
|
||||
.then(function (response) {
|
||||
resolve(response.data);
|
||||
})
|
||||
.catch(function (error) {
|
||||
reject(error);
|
||||
});
|
||||
});
|
||||
} else if (typeof to === "object") {
|
||||
return new Promise((resolve, reject) => {
|
||||
axios.get(`${ecoURL}/sendTransactionByIds?from=${this.svid}&to=${to.svid}&amount=${amount}&auth=${this.#apikey}&detail=${reason}`)
|
||||
.then(function (response) {
|
||||
resolve(response.data);
|
||||
})
|
||||
.catch(function (error) {
|
||||
reject(error);
|
||||
});
|
||||
});
|
||||
} else {
|
||||
throw "The 'to' parameter must be a string or an object!";
|
||||
}
|
||||
}
|
||||
|
||||
doesGroupExist() {
|
||||
return new Promise((resolve, reject) => {
|
||||
axios.get(`${groupURL}/doesGroupExist?svid=${this.svid}`)
|
||||
.then(function (response) {
|
||||
resolve(response.data);
|
||||
})
|
||||
.catch(function (error) {
|
||||
reject(error);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
getGroupMembers() {
|
||||
return new Promise((resolve, reject) => {
|
||||
axios.get(`${groupURL}/getGroupMembers?svid=${this.svid}`)
|
||||
.then(function (response) {
|
||||
resolve(response.data);
|
||||
})
|
||||
.catch(function (error) {
|
||||
reject(error);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
hasGroupPermission(user, permission) {
|
||||
if (typeof to === "string") {
|
||||
return new Promise((resolve, reject) => {
|
||||
axios.get(`${groupURL}/hasGroupPermission?svid=${this.svid}&usersvid=${user}&permission=${permission}`)
|
||||
.then(function (response) {
|
||||
resolve(response.data);
|
||||
})
|
||||
.catch(function (error) {
|
||||
reject(error);
|
||||
});
|
||||
});
|
||||
} else if (typeof to === "object") {
|
||||
return new Promise((resolve, reject) => {
|
||||
axios.get(`${groupURL}/hasGroupPermission?svid=${this.svid}&usersvid=${user.svid}&permission=${permission}`)
|
||||
.then(function (response) {
|
||||
resolve(response.data);
|
||||
})
|
||||
.catch(function (error) {
|
||||
reject(error);
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class Auth {
|
||||
#clientsecret = undefined;
|
||||
#authcode = undefined;
|
||||
|
||||
constructor(clientid, clientsecret) {
|
||||
this.clientid = clientid;
|
||||
this.#clientsecret = clientsecret;
|
||||
}
|
||||
|
||||
genLink(redirect, scope, state) {
|
||||
if (redirect === undefined || scope === undefined) {
|
||||
throw "Both parameters 'redirect' and 'scope' must be defined!"
|
||||
} else if (state === undefined) {
|
||||
state = "";
|
||||
urlReturn = `${authURL}/authorize?response_type=code&client_id=${this.clientid}&redirect_uri=${redirect}&scope=${scope}&state=${state}`;
|
||||
urlReturn = urlReturn.split(" ").join("%20");
|
||||
return urlReturn;
|
||||
} else {
|
||||
urlReturn = `${authURL}/authorize?response_type=code&client_id=${this.clientid}&redirect_uri=${redirect}&scope=${scope}&state=${state}`;
|
||||
urlReturn = urlReturn.split(" ").join("%20");
|
||||
return urlReturn;
|
||||
}
|
||||
}
|
||||
|
||||
setAuthCode(authcode) {
|
||||
this.#authcode = authcode;
|
||||
}
|
||||
|
||||
requestToken(redirect) {
|
||||
return new Promise((resolve, reject) => {
|
||||
axios.get(`${authURL}/requestToken?grant_type=authorization_code&code=${this.#authcode}&redirect_uri=${redirect}&client_id=${this.clientid}&client_secret=${this.#clientsecret}`)
|
||||
.then(function (response) {
|
||||
resolve(response.data);
|
||||
})
|
||||
.catch(function (error) {
|
||||
reject(error);
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
const User = require('./modules/User.js')
|
||||
const Stock = require('./modules/Stock.js')
|
||||
const District = require('./modules/District.js')
|
||||
const Group = require('./modules/Group.js')
|
||||
const Auth = require('./modules/Auth.js')
|
||||
const TransactionHub = require('./modules/TransactionHub.js')
|
||||
const ExchangeHub = require('./modules/ExchangeHub.js')
|
||||
|
||||
module.exports = {
|
||||
User,
|
||||
Stock,
|
||||
District,
|
||||
Group,
|
||||
Auth
|
||||
Auth,
|
||||
TransactionHub,
|
||||
ExchangeHub
|
||||
}
|
|
@ -0,0 +1,53 @@
|
|||
// SpookVooper API - modules/District.js
|
||||
// Written by Brendan Lane - https://brndnln.dev/
|
||||
|
||||
const axios = require('axios')
|
||||
const ecoURL = 'https://api.spookvooper.com/eco'
|
||||
|
||||
class District {
|
||||
constructor(name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
getWealth(type) {
|
||||
switch (type) {
|
||||
case "ALL":
|
||||
return new Promise((resolve, reject) => {
|
||||
axios.get(`${ecoURL}/getDistrictWealth?id=${this.name}`)
|
||||
.then(function (response) {
|
||||
resolve(response.data);
|
||||
})
|
||||
.catch(function (error) {
|
||||
reject(error);
|
||||
});
|
||||
});
|
||||
|
||||
case "USER":
|
||||
return new Promise((resolve, reject) => {
|
||||
axios.get(`${ecoURL}/getDistrictUserWealth?id=${this.name}`)
|
||||
.then(function (response) {
|
||||
resolve(response.data);
|
||||
})
|
||||
.catch(function (error) {
|
||||
reject(error);
|
||||
});
|
||||
});
|
||||
|
||||
case "GROUP":
|
||||
return new Promise((resolve, reject) => {
|
||||
axios.get(`${ecoURL}/getDistrictGroupWealth?id=${this.name}`)
|
||||
.then(function (response) {
|
||||
resolve(response.data);
|
||||
})
|
||||
.catch(function (error) {
|
||||
reject(error);
|
||||
});
|
||||
});
|
||||
|
||||
default:
|
||||
throw "Parameter 'type' must be 'ALL', 'USER', or 'GROUP'";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = District
|
|
@ -0,0 +1,104 @@
|
|||
// SpookVooper API - modules/ExchangeHub.js
|
||||
// Written by Brendan Lane - https://brndnln.dev/
|
||||
|
||||
const signalR = require('@microsoft/signalr')
|
||||
const EventEmitter = require('events')
|
||||
|
||||
class ExchangeEmitter extends EventEmitter {}
|
||||
|
||||
class ExchangeHub {
|
||||
#connection = new signalR.HubConnectionBuilder()
|
||||
.withUrl('https://spookvooper.com/ExchangeHub')
|
||||
.withAutomaticReconnect()
|
||||
.configureLogging(signalR.LogLevel.Information)
|
||||
.build()
|
||||
|
||||
exchangeEvent = new ExchangeEmitter()
|
||||
|
||||
constructor() {
|
||||
// Event Handlers
|
||||
this.#connection.on('StockOffer', (offer) => {
|
||||
this.exchangeEvent.emit('NewOffer', offer)
|
||||
})
|
||||
|
||||
this.#connection.on('StockOfferCancel', (offer) => {
|
||||
this.exchangeEvent.emit('OfferCancelled', offer)
|
||||
})
|
||||
|
||||
this.#connection.on('StockTrade', (trade) => {
|
||||
this.exchangeEvent.emit('StockTrade', trade)
|
||||
})
|
||||
|
||||
this.#connection.on('RecieveMessage', (message, mode) => {
|
||||
this.exchangeEvent.emit('RecieveMessage', message, mode)
|
||||
})
|
||||
|
||||
this.#connection.on('RecieveMessageHistory', (messages, modes) => {
|
||||
this.exchangeEvent.emit('RevieveMessageHistory', messages, modes)
|
||||
})
|
||||
|
||||
// Start of connection logic
|
||||
this.#connection.onclose(async (e) => {
|
||||
await this.onClosed(e)
|
||||
})
|
||||
|
||||
this.#connection.on()
|
||||
|
||||
this.start()
|
||||
}
|
||||
|
||||
async start() {
|
||||
console.log("Starting ExchangeHub Connection...")
|
||||
|
||||
try {
|
||||
await this.#connection.start()
|
||||
console.log("Connected to ExchangeHub")
|
||||
} catch (e) {
|
||||
console.error("ExchangeHub Error: Connection failed while trying to establish a connnection\n", e)
|
||||
console.log("Retrying in 5 seconds")
|
||||
setTimeout(() => {
|
||||
this.start()
|
||||
}, 5000)
|
||||
}
|
||||
}
|
||||
|
||||
async onClosed(e) {
|
||||
console.error("ExchangeHub Error: Connection closed unexpectedly\n", e)
|
||||
await this.start()
|
||||
}
|
||||
|
||||
sendChatMessage(message, accountid, apikey, ticker, tradeState) {
|
||||
return new Promise((resolve, reject) => {
|
||||
if (message === undefined || accountid === undefined || apikey === undefined || ticker === undefined || tradeState === undefined) {
|
||||
throw "All variables are needed for this to work."
|
||||
}
|
||||
|
||||
tradeState = tradeState.toUpperCase()
|
||||
if (tradeState !== "BUY" && tradeState !== "SELL") {
|
||||
throw "The tradeState argument must either be 'BUY' or 'SELL'";
|
||||
}
|
||||
|
||||
this.#connection.invoke("SendMessage", accountid, apikey, message, ticker, tradeState)
|
||||
.then(function () {
|
||||
resolve(true)
|
||||
})
|
||||
.catch(function (err) {
|
||||
reject(err)
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
getMessageHistory() {
|
||||
return new Promise((resolve, reject) => {
|
||||
this.#connection.invoke('RequestHistory')
|
||||
.then(function (val) {
|
||||
resolve(val)
|
||||
})
|
||||
.catch(function (err) {
|
||||
reject(err)
|
||||
})
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = ExchangeHub
|
|
@ -0,0 +1,72 @@
|
|||
// SpookVooper API - modules/Stock.js
|
||||
// Written by Brendan Lane - https://brndnln.dev/
|
||||
|
||||
const axios = require('axios');
|
||||
const ecoURL = 'https://api.spookvooper.com/eco'
|
||||
|
||||
class Stock {
|
||||
constructor(ticker) {
|
||||
this.ticker = ticker.toUpperCase();
|
||||
}
|
||||
|
||||
getValue() {
|
||||
return new Promise((resolve, reject) => {
|
||||
axios.get(`${ecoURL}/getStockValue?ticker=${this.ticker}`)
|
||||
.then(function (response) {
|
||||
resolve(response.data);
|
||||
})
|
||||
.catch(function (error) {
|
||||
reject(error);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
getStockBuyPrice() {
|
||||
return new Promise((resolve, reject) => {
|
||||
axios.get(`${ecoURL}/getStockBuyPrice?ticker=${this.ticker}`)
|
||||
.then(function (response) {
|
||||
resolve(response.data);
|
||||
})
|
||||
.catch(function (error) {
|
||||
reject(error);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
getQueueInfo(type) {
|
||||
switch (type) {
|
||||
case "BUY":
|
||||
break;
|
||||
|
||||
case "SELL":
|
||||
break;
|
||||
|
||||
default:
|
||||
throw "Parameter 'type' must be 'BUY' or 'SELL'"
|
||||
}
|
||||
|
||||
return new Promise((resolve, reject) => {
|
||||
axios.get(`${ecoURL}/getQueueInfo?ticker=${this.ticker}&type=${type}`)
|
||||
.then(function (response) {
|
||||
resolve(response.data);
|
||||
})
|
||||
.catch(function (error) {
|
||||
reject(error);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
getOwner() {
|
||||
return new Promise((resolve, reject) => {
|
||||
axios.get(`${ecoURL}/getOwnerData?ticker=${this.ticker}`)
|
||||
.then(function (response) {
|
||||
resolve(response.data);
|
||||
})
|
||||
.catch(function (error) {
|
||||
reject(error);
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = Stock
|
|
@ -0,0 +1,65 @@
|
|||
// SpookVooper API - modules/TransactionHub.js
|
||||
// Written by Brendan Lane - https://brndnln.dev/
|
||||
|
||||
const signalR = require('@microsoft/signalr')
|
||||
const EventEmitter = require('events')
|
||||
|
||||
class TransactionEmitter extends EventEmitter {}
|
||||
|
||||
class TransactionHub {
|
||||
#connection = new signalR.HubConnectionBuilder()
|
||||
.withUrl('https://spookvooper.com/TransactionHub')
|
||||
.withAutomaticReconnect()
|
||||
.configureLogging(signalR.LogLevel.Information)
|
||||
.build();
|
||||
|
||||
transactionEvent = new TransactionEmitter()
|
||||
|
||||
#val = undefined;
|
||||
|
||||
fromAccount = undefined
|
||||
toAccount = undefined
|
||||
|
||||
constructor() {
|
||||
// Event Handlers
|
||||
this.#connection.on('NotifyTransaction', (recieved) => {
|
||||
this.#val = JSON.parse(recieved);
|
||||
this.fromAccount = this.#val.FromAccount;
|
||||
this.toAccount = this.#val.ToAccount;
|
||||
|
||||
this.transactionEvent.emit('NewTransaction', recieved);
|
||||
})
|
||||
|
||||
// Start connection logic
|
||||
this.#connection.onclose(async (e) => {
|
||||
await this.onClosed(e)
|
||||
});
|
||||
|
||||
this.#connection.on();
|
||||
|
||||
this.start();
|
||||
}
|
||||
|
||||
async start() {
|
||||
console.log("Starting TransactionHub Connection...");
|
||||
|
||||
try {
|
||||
await this.#connection.start();
|
||||
console.log("Connected to TransactionHub");
|
||||
} catch (e) {
|
||||
console.error("TransactionHub Error: Connection failed while trying to establish a connection\n", e)
|
||||
console.log("Retrying in 5 seconds")
|
||||
setTimeout(() => {
|
||||
this.start();
|
||||
}, 5000);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
async onClosed(e) {
|
||||
console.error("TransactionHub Error: Connection closed unexpectedly\n", e);
|
||||
await this.start();
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = TransactionHub
|
|
@ -1,65 +1,49 @@
|
|||
// SpookVooper API - modules/auth.js
|
||||
// Written by Brendan Lane
|
||||
// SpookVooper API - modules/Auth.js
|
||||
// Written by Brendan Lane - https://brndnln.dev/
|
||||
|
||||
/** @module modules/auth */
|
||||
import axios from 'axios'
|
||||
const axios = require('axios')
|
||||
const authURL = 'https://spookvooper.com/oauth2'
|
||||
let urlReturn;
|
||||
|
||||
const baseURL = 'https://spookvooper.com/oauth2'
|
||||
let urlReturn
|
||||
class Auth {
|
||||
#clientsecret = undefined;
|
||||
#authcode = undefined;
|
||||
|
||||
/**
|
||||
* Generates a Oauth2 URL for you. This just builds a string and DOES NOT need a promise. For any updates on how this works, check #sv-developer in the discord server. https://discord.gg/spookvooper. Get more information at the wiki. https://github.com/bowlingballindustries/spookvooper-api/wiki/Auth#authorize
|
||||
* @function authorize
|
||||
* @param {string} response_type The type of response you get back. Currently the only one that is supported is "code". This parameter is requried.
|
||||
* @param {string} client_id The client ID of your Oauth2 app. To get your client ID, go to https://spookvooper.com/oauth2. This parameter is requried.
|
||||
* @param {string} redirect_uri Where to redirect to once authorization has been granted. Will return a "code" and "state" parameter if successful. This parameter is requried.
|
||||
* @param {string} scope The scope of what you want to be able to receive. All scopes are allowed. This parameter is requried.
|
||||
* @param {string} state The state parameter can have anything here. Will be returned to the server upon completion. This parameter is optional.
|
||||
* @returns {string} Will return a string containing a link to the Oauth2 authorization page. If there is an error, it will return "ERROR: Oauth2 URL Builder - A required variable is undefined or is missing."
|
||||
*/
|
||||
function authorize (response_type, client_id, redirect_uri, scope, state) {
|
||||
if (response_type === undefined || client_id === undefined || redirect_uri === undefined || scope === undefined) {
|
||||
return 'ERROR: Oauth2 URL Builder - A required variable is undefined or is missing.'
|
||||
} else if (state === undefined) {
|
||||
state = ''
|
||||
urlReturn = `${baseURL}/authorize?response_type=${response_type}&client_id=${client_id}&redirect_uri=${redirect_uri}&scope=${scope}&state=${state}`
|
||||
urlReturn = urlReturn.split(' ').join('%20')
|
||||
return urlReturn
|
||||
} else {
|
||||
urlReturn = `${baseURL}/authorize?response_type=${response_type}&client_id=${client_id}&redirect_uri=${redirect_uri}&scope=${scope}&state=${state}`
|
||||
urlReturn = urlReturn.split(' ').join('%20')
|
||||
return urlReturn
|
||||
constructor(clientid, clientsecret) {
|
||||
this.clientid = clientid;
|
||||
this.#clientsecret = clientsecret;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets a token that you can use for Oauth2. For any updates on how this works, check #sv-developer in the discord server. https://discord.gg/spookvooper
|
||||
* @function requestToken
|
||||
* @param {string} grant_type The type of response you get back. Currently the one that is supported is "authorization_code"
|
||||
* @param {string} code The code that was returned from the authorization.
|
||||
* @param {string} redirect_uri Where to redirect to once authorization has been granted. Will return a "code" and "state" parameter if successful.
|
||||
* @param {string} client_id The client ID of your Oauth2 app. To get your client ID, go to https://spookvooper.com/oauth2.
|
||||
* @param {string} client_secret The client secret of your Oauth2 app. To get your client ID, go to https://spookvooper.com/oauth2. This WILL NOT get shared with anything other than the function it is in, and will not get sent anywhere other than https://spookvooper.com/. We take privacy very seriously. You must keep this safe.
|
||||
* @param {boolean} errToConsole If there is an error, send it to console, instead of returning. Defaults to false
|
||||
* @returns {string} The data from the HTTP GET request, but because of the way it's handled, will always be a string (should be a JSON Object containing the token, expire time in seconds, and the svid of the authorized user).
|
||||
*/
|
||||
function requestToken (grant_type, code, redirect_uri, client_id, client_secret, errToConsole) {
|
||||
genLink(redirect, scope, state) {
|
||||
if (redirect === undefined || scope === undefined) {
|
||||
throw "Both parameters 'redirect' and 'scope' must be defined!"
|
||||
} else if (state === undefined) {
|
||||
state = "";
|
||||
urlReturn = `${authURL}/authorize?response_type=code&client_id=${this.clientid}&redirect_uri=${redirect}&scope=${scope}&state=${state}`;
|
||||
urlReturn = urlReturn.split(" ").join("%20");
|
||||
return urlReturn;
|
||||
} else {
|
||||
urlReturn = `${authURL}/authorize?response_type=code&client_id=${this.clientid}&redirect_uri=${redirect}&scope=${scope}&state=${state}`;
|
||||
urlReturn = urlReturn.split(" ").join("%20");
|
||||
return urlReturn;
|
||||
}
|
||||
}
|
||||
|
||||
setAuthCode(authcode) {
|
||||
this.#authcode = authcode;
|
||||
}
|
||||
|
||||
requestToken(redirect) {
|
||||
return new Promise((resolve, reject) => {
|
||||
axios.get(`${baseURL}/requestToken?grant_type=${grant_type}&code=${code}&redirect_uri=${redirect_uri}&client_id=${client_id}&client_secret=${client_secret}`)
|
||||
axios.get(`${authURL}/requestToken?grant_type=authorization_code&code=${this.#authcode}&redirect_uri=${redirect}&client_id=${this.clientid}&client_secret=${this.#clientsecret}`)
|
||||
.then(function (response) {
|
||||
resolve(response.data)
|
||||
resolve(response.data);
|
||||
})
|
||||
.catch(function (error) {
|
||||
if (errToConsole) {
|
||||
console.warn(error)
|
||||
} else {
|
||||
reject(error)
|
||||
reject(error);
|
||||
});
|
||||
});
|
||||
}
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
export default {
|
||||
authorize,
|
||||
requestToken
|
||||
}
|
||||
module.exports = Auth
|
||||
|
|
180
modules/group.js
180
modules/group.js
|
@ -1,137 +1,113 @@
|
|||
// SpookVooper API - modules/group.js
|
||||
// Written by Brendan Lane
|
||||
// SpookVooper API - modules/Group.js
|
||||
// Written by Brendan Lane - https://brndnln.dev/
|
||||
|
||||
/** @module modules/group */
|
||||
import axios from 'axios'
|
||||
const axios = require('axios');
|
||||
const groupURL = 'https://api.spookvooper.com/group'
|
||||
const ecoURL = 'https://api.spookvooper.com/eco'
|
||||
|
||||
const baseURL = 'https://api.spookvooper.com/group'
|
||||
class Group {
|
||||
svid = undefined;
|
||||
#apikey = undefined;
|
||||
|
||||
/**
|
||||
* Checks if a group exists.
|
||||
* @function doesGroupExist
|
||||
* @param {string} svid The svid of the group in question.
|
||||
* @param {boolean} errToConsole If there is an error, send it to console, instead of returning. Defaults to false
|
||||
* @returns {string} The data from the HTTP GET request, but because of the way it's handled, will always be a string (should be a boolean).
|
||||
* @author Brendan Lane <me@imbl.me>
|
||||
*/
|
||||
function doesGroupExist (svid, errToConsole) {
|
||||
constructor(svid) {
|
||||
this.svid = svid;
|
||||
|
||||
if (!this.svid.startsWith('g-')) {
|
||||
throw "Error: A group must have a 'g-' or else it is not a group!"
|
||||
}
|
||||
}
|
||||
|
||||
getGroup() {
|
||||
return new Promise((resolve, reject) => {
|
||||
axios.get(`${baseURL}/doesGroupExist?svid=${svid}`)
|
||||
axios.get(`${groupURL}/getGroup?svid=${this.svid}`)
|
||||
.then(function (response) {
|
||||
resolve(response.data)
|
||||
resolve(response.data);
|
||||
})
|
||||
.catch(function (error) {
|
||||
if (errToConsole) {
|
||||
console.warn(error)
|
||||
} else {
|
||||
reject(error)
|
||||
reject(error);
|
||||
});
|
||||
});
|
||||
}
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets all members of a group.
|
||||
* @function getGroupMembers
|
||||
* @param {string} svid The svid of the group in question.
|
||||
* @param {boolean} errToConsole If there is an error, send it to console, instead of returning. Defaults to false
|
||||
* @returns {string} The data from the HTTP GET request, but because of the way it's handled, will always be a string (should be a JSON object).
|
||||
* @author Brendan Lane <me@imbl.me>
|
||||
*/
|
||||
function getGroupMembers (svid, errToConsole) {
|
||||
set setApiKey(key) {
|
||||
this.#apikey = key;
|
||||
}
|
||||
|
||||
sendCredits(amount, to, reason) {
|
||||
if (typeof to === "string") {
|
||||
return new Promise((resolve, reject) => {
|
||||
axios.get(`${baseURL}/getGroupMembers?svid=${svid}`)
|
||||
axios.get(`${ecoURL}/sendTransactionByIds?from=${this.svid}&to=${to}&amount=${amount}&auth=${this.#apikey}&detail=${reason}`)
|
||||
.then(function (response) {
|
||||
resolve(response.data)
|
||||
resolve(response.data);
|
||||
})
|
||||
.catch(function (error) {
|
||||
if (errToConsole) {
|
||||
console.warn(error)
|
||||
} else {
|
||||
reject(error)
|
||||
}
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets all members of a group.
|
||||
* @function hasGroupPermission
|
||||
* @param {string} svid The svid of the group in question.
|
||||
* @param {string} usersvid The svid of the user you want to check
|
||||
* @param {string} permission The permission you want to search for
|
||||
* @param {boolean} errToConsole If there is an error, send it to console, instead of returning. Defaults to false
|
||||
* @returns {string} The data from the HTTP GET request, but because of the way it's handled, will always be a string (should be a JSON object).
|
||||
* @author Brendan Lane <me@imbl.me>
|
||||
*/
|
||||
function hasGroupPermission (svid, usersvid, permission, errToConsole) {
|
||||
reject(error);
|
||||
});
|
||||
});
|
||||
} else if (typeof to === "object") {
|
||||
return new Promise((resolve, reject) => {
|
||||
axios.get(`${baseURL}/hasGroupPermission?svid=${svid}&usersvid=${usersvid}&permission=${permission}`)
|
||||
axios.get(`${ecoURL}/sendTransactionByIds?from=${this.svid}&to=${to.svid}&amount=${amount}&auth=${this.#apikey}&detail=${reason}`)
|
||||
.then(function (response) {
|
||||
resolve(response.data)
|
||||
resolve(response.data);
|
||||
})
|
||||
.catch(function (error) {
|
||||
if (errToConsole) {
|
||||
console.warn(error)
|
||||
reject(error);
|
||||
});
|
||||
});
|
||||
} else {
|
||||
reject(error)
|
||||
throw "The 'to' parameter must be a string or an object!";
|
||||
}
|
||||
}
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the SVID from a name
|
||||
* @function getSvidFromName
|
||||
* @param {string} name The name of the group
|
||||
* @param {boolean} errToConsole If there is an error, send it to console, instead of returning. Defaults to false
|
||||
* @returns {string} The data from the HTTP GET request, but because of the way it's handled, will always be a string (should be a JSON object).
|
||||
* @author Brendan Lane <me@imbl.me>
|
||||
*/
|
||||
function getSvidFromName (name, errToConsole) {
|
||||
doesGroupExist() {
|
||||
return new Promise((resolve, reject) => {
|
||||
axios.get(`${baseURL}/getSvidFromName?name=${name}`)
|
||||
axios.get(`${groupURL}/doesGroupExist?svid=${this.svid}`)
|
||||
.then(function (response) {
|
||||
resolve(response.data)
|
||||
resolve(response.data);
|
||||
})
|
||||
.catch(function (error) {
|
||||
if (errToConsole) {
|
||||
console.warn(error)
|
||||
} else {
|
||||
reject(error)
|
||||
reject(error);
|
||||
});
|
||||
});
|
||||
}
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the name of the group
|
||||
* @function getGroupMembers
|
||||
* @param {string} svid The svid of the group in question.
|
||||
* @param {boolean} errToConsole If there is an error, send it to console, instead of returning. Defaults to false
|
||||
* @returns {string} The data from the HTTP GET request, but because of the way it's handled, will always be a string (should be a JSON object).
|
||||
* @author Brendan Lane <me@imbl.me>
|
||||
*/
|
||||
function getName (svid, errToConsole) {
|
||||
getGroupMembers() {
|
||||
return new Promise((resolve, reject) => {
|
||||
axios.get(`${baseURL}/getName?svid=${svid}`)
|
||||
axios.get(`${groupURL}/getGroupMembers?svid=${this.svid}`)
|
||||
.then(function (response) {
|
||||
resolve(response.data)
|
||||
resolve(response.data);
|
||||
})
|
||||
.catch(function (error) {
|
||||
if (errToConsole) {
|
||||
console.warn(error)
|
||||
} else {
|
||||
reject(error)
|
||||
reject(error);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
hasGroupPermission(user, permission) {
|
||||
if (typeof to === "string") {
|
||||
return new Promise((resolve, reject) => {
|
||||
axios.get(`${groupURL}/hasGroupPermission?svid=${this.svid}&usersvid=${user}&permission=${permission}`)
|
||||
.then(function (response) {
|
||||
resolve(response.data);
|
||||
})
|
||||
.catch(function (error) {
|
||||
reject(error);
|
||||
});
|
||||
});
|
||||
} else if (typeof to === "object") {
|
||||
return new Promise((resolve, reject) => {
|
||||
axios.get(`${groupURL}/hasGroupPermission?svid=${this.svid}&usersvid=${user.svid}&permission=${permission}`)
|
||||
.then(function (response) {
|
||||
resolve(response.data);
|
||||
})
|
||||
.catch(function (error) {
|
||||
reject(error);
|
||||
});
|
||||
});
|
||||
} else {
|
||||
throw "Argument user must either be a string or an object"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export default {
|
||||
doesGroupExist,
|
||||
getGroupMembers,
|
||||
hasGroupPermission,
|
||||
getSvidFromName,
|
||||
getName
|
||||
}
|
||||
module.exports = Group
|
|
@ -0,0 +1,65 @@
|
|||
// SpookVooper API - modules/auth.js
|
||||
// Written by Brendan Lane
|
||||
|
||||
/** @module modules/auth */
|
||||
import axios from 'axios'
|
||||
|
||||
const baseURL = 'https://spookvooper.com/oauth2'
|
||||
let urlReturn
|
||||
|
||||
/**
|
||||
* Generates a Oauth2 URL for you. This just builds a string and DOES NOT need a promise. For any updates on how this works, check #sv-developer in the discord server. https://discord.gg/spookvooper. Get more information at the wiki. https://github.com/bowlingballindustries/spookvooper-api/wiki/Auth#authorize
|
||||
* @function authorize
|
||||
* @param {string} response_type The type of response you get back. Currently the only one that is supported is "code". This parameter is requried.
|
||||
* @param {string} client_id The client ID of your Oauth2 app. To get your client ID, go to https://spookvooper.com/oauth2. This parameter is requried.
|
||||
* @param {string} redirect_uri Where to redirect to once authorization has been granted. Will return a "code" and "state" parameter if successful. This parameter is requried.
|
||||
* @param {string} scope The scope of what you want to be able to receive. All scopes are allowed. This parameter is requried.
|
||||
* @param {string} state The state parameter can have anything here. Will be returned to the server upon completion. This parameter is optional.
|
||||
* @returns {string} Will return a string containing a link to the Oauth2 authorization page. If there is an error, it will return "ERROR: Oauth2 URL Builder - A required variable is undefined or is missing."
|
||||
*/
|
||||
function authorize (response_type, client_id, redirect_uri, scope, state) {
|
||||
if (response_type === undefined || client_id === undefined || redirect_uri === undefined || scope === undefined) {
|
||||
return 'ERROR: Oauth2 URL Builder - A required variable is undefined or is missing.'
|
||||
} else if (state === undefined) {
|
||||
state = ''
|
||||
urlReturn = `${baseURL}/authorize?response_type=${response_type}&client_id=${client_id}&redirect_uri=${redirect_uri}&scope=${scope}&state=${state}`
|
||||
urlReturn = urlReturn.split(' ').join('%20')
|
||||
return urlReturn
|
||||
} else {
|
||||
urlReturn = `${baseURL}/authorize?response_type=${response_type}&client_id=${client_id}&redirect_uri=${redirect_uri}&scope=${scope}&state=${state}`
|
||||
urlReturn = urlReturn.split(' ').join('%20')
|
||||
return urlReturn
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets a token that you can use for Oauth2. For any updates on how this works, check #sv-developer in the discord server. https://discord.gg/spookvooper
|
||||
* @function requestToken
|
||||
* @param {string} grant_type The type of response you get back. Currently the one that is supported is "authorization_code"
|
||||
* @param {string} code The code that was returned from the authorization.
|
||||
* @param {string} redirect_uri Where to redirect to once authorization has been granted. Will return a "code" and "state" parameter if successful.
|
||||
* @param {string} client_id The client ID of your Oauth2 app. To get your client ID, go to https://spookvooper.com/oauth2.
|
||||
* @param {string} client_secret The client secret of your Oauth2 app. To get your client ID, go to https://spookvooper.com/oauth2. This WILL NOT get shared with anything other than the function it is in, and will not get sent anywhere other than https://spookvooper.com/. We take privacy very seriously. You must keep this safe.
|
||||
* @param {boolean} errToConsole If there is an error, send it to console, instead of returning. Defaults to false
|
||||
* @returns {string} The data from the HTTP GET request, but because of the way it's handled, will always be a string (should be a JSON Object containing the token, expire time in seconds, and the svid of the authorized user).
|
||||
*/
|
||||
function requestToken (grant_type, code, redirect_uri, client_id, client_secret, errToConsole) {
|
||||
return new Promise((resolve, reject) => {
|
||||
axios.get(`${baseURL}/requestToken?grant_type=${grant_type}&code=${code}&redirect_uri=${redirect_uri}&client_id=${client_id}&client_secret=${client_secret}`)
|
||||
.then(function (response) {
|
||||
resolve(response.data)
|
||||
})
|
||||
.catch(function (error) {
|
||||
if (errToConsole) {
|
||||
console.warn(error)
|
||||
} else {
|
||||
reject(error)
|
||||
}
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
export default {
|
||||
authorize,
|
||||
requestToken
|
||||
}
|
|
@ -0,0 +1,137 @@
|
|||
// SpookVooper API - modules/group.js
|
||||
// Written by Brendan Lane
|
||||
|
||||
/** @module modules/group */
|
||||
import axios from 'axios'
|
||||
|
||||
const baseURL = 'https://api.spookvooper.com/group'
|
||||
|
||||
/**
|
||||
* Checks if a group exists.
|
||||
* @function doesGroupExist
|
||||
* @param {string} svid The svid of the group in question.
|
||||
* @param {boolean} errToConsole If there is an error, send it to console, instead of returning. Defaults to false
|
||||
* @returns {string} The data from the HTTP GET request, but because of the way it's handled, will always be a string (should be a boolean).
|
||||
* @author Brendan Lane <me@imbl.me>
|
||||
*/
|
||||
function doesGroupExist (svid, errToConsole) {
|
||||
return new Promise((resolve, reject) => {
|
||||
axios.get(`${baseURL}/doesGroupExist?svid=${svid}`)
|
||||
.then(function (response) {
|
||||
resolve(response.data)
|
||||
})
|
||||
.catch(function (error) {
|
||||
if (errToConsole) {
|
||||
console.warn(error)
|
||||
} else {
|
||||
reject(error)
|
||||
}
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets all members of a group.
|
||||
* @function getGroupMembers
|
||||
* @param {string} svid The svid of the group in question.
|
||||
* @param {boolean} errToConsole If there is an error, send it to console, instead of returning. Defaults to false
|
||||
* @returns {string} The data from the HTTP GET request, but because of the way it's handled, will always be a string (should be a JSON object).
|
||||
* @author Brendan Lane <me@imbl.me>
|
||||
*/
|
||||
function getGroupMembers (svid, errToConsole) {
|
||||
return new Promise((resolve, reject) => {
|
||||
axios.get(`${baseURL}/getGroupMembers?svid=${svid}`)
|
||||
.then(function (response) {
|
||||
resolve(response.data)
|
||||
})
|
||||
.catch(function (error) {
|
||||
if (errToConsole) {
|
||||
console.warn(error)
|
||||
} else {
|
||||
reject(error)
|
||||
}
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets all members of a group.
|
||||
* @function hasGroupPermission
|
||||
* @param {string} svid The svid of the group in question.
|
||||
* @param {string} usersvid The svid of the user you want to check
|
||||
* @param {string} permission The permission you want to search for
|
||||
* @param {boolean} errToConsole If there is an error, send it to console, instead of returning. Defaults to false
|
||||
* @returns {string} The data from the HTTP GET request, but because of the way it's handled, will always be a string (should be a JSON object).
|
||||
* @author Brendan Lane <me@imbl.me>
|
||||
*/
|
||||
function hasGroupPermission (svid, usersvid, permission, errToConsole) {
|
||||
return new Promise((resolve, reject) => {
|
||||
axios.get(`${baseURL}/hasGroupPermission?svid=${svid}&usersvid=${usersvid}&permission=${permission}`)
|
||||
.then(function (response) {
|
||||
resolve(response.data)
|
||||
})
|
||||
.catch(function (error) {
|
||||
if (errToConsole) {
|
||||
console.warn(error)
|
||||
} else {
|
||||
reject(error)
|
||||
}
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the SVID from a name
|
||||
* @function getSvidFromName
|
||||
* @param {string} name The name of the group
|
||||
* @param {boolean} errToConsole If there is an error, send it to console, instead of returning. Defaults to false
|
||||
* @returns {string} The data from the HTTP GET request, but because of the way it's handled, will always be a string (should be a JSON object).
|
||||
* @author Brendan Lane <me@imbl.me>
|
||||
*/
|
||||
function getSvidFromName (name, errToConsole) {
|
||||
return new Promise((resolve, reject) => {
|
||||
axios.get(`${baseURL}/getSvidFromName?name=${name}`)
|
||||
.then(function (response) {
|
||||
resolve(response.data)
|
||||
})
|
||||
.catch(function (error) {
|
||||
if (errToConsole) {
|
||||
console.warn(error)
|
||||
} else {
|
||||
reject(error)
|
||||
}
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the name of the group
|
||||
* @function getGroupMembers
|
||||
* @param {string} svid The svid of the group in question.
|
||||
* @param {boolean} errToConsole If there is an error, send it to console, instead of returning. Defaults to false
|
||||
* @returns {string} The data from the HTTP GET request, but because of the way it's handled, will always be a string (should be a JSON object).
|
||||
* @author Brendan Lane <me@imbl.me>
|
||||
*/
|
||||
function getName (svid, errToConsole) {
|
||||
return new Promise((resolve, reject) => {
|
||||
axios.get(`${baseURL}/getName?svid=${svid}`)
|
||||
.then(function (response) {
|
||||
resolve(response.data)
|
||||
})
|
||||
.catch(function (error) {
|
||||
if (errToConsole) {
|
||||
console.warn(error)
|
||||
} else {
|
||||
reject(error)
|
||||
}
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
export default {
|
||||
doesGroupExist,
|
||||
getGroupMembers,
|
||||
hasGroupPermission,
|
||||
getSvidFromName,
|
||||
getName
|
||||
}
|
|
@ -0,0 +1,261 @@
|
|||
// SpookVooper API - modules/user.js
|
||||
// Written by Brendan Lane
|
||||
|
||||
/** @module modules/user */
|
||||
import axios from 'axios'
|
||||
|
||||
const baseURL = 'https://api.spookvooper.com/user'
|
||||
|
||||
/**
|
||||
* Gets information on the user
|
||||
* @function getUser
|
||||
* @param {string} svid The svid for the user.
|
||||
* @param {boolean} errToConsole If there is an error, send it to console, instead of returning. Defaults to false
|
||||
* @returns {string} The data from the HTTP GET request, but because of the way it's handled, will always be a string (should be a JSON object).
|
||||
* @author Brendan Lane <me@imbl.me>
|
||||
*/
|
||||
function getUser (svid, errToConsole) {
|
||||
return new Promise((resolve, reject) => {
|
||||
axios.get(`${baseURL}/getUser?svid=${svid}`)
|
||||
.then(function (response) {
|
||||
resolve(response.data)
|
||||
})
|
||||
.catch(function (error) {
|
||||
if (errToConsole) {
|
||||
console.warn(error)
|
||||
} else {
|
||||
reject(error)
|
||||
}
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the username of a user
|
||||
* @function getUsername
|
||||
* @param {string} svid The svid for the user lookup.
|
||||
* @param {boolean} errToConsole If there is an error, send it to console, instead of returning. Defaults to false
|
||||
* @returns {string} The data from the HTTP GET request, but because of the way it's handled, will always be a string (should be a string).
|
||||
* @author Brendan Lane <me@imbl.me>
|
||||
*/
|
||||
function getUsername (svid, errToConsole) {
|
||||
return new Promise((resolve, reject) => {
|
||||
axios.get(`${baseURL}/getUsername?svid=${svid}`)
|
||||
.then(function (response) {
|
||||
resolve(response.data)
|
||||
})
|
||||
.catch(function (error) {
|
||||
if (errToConsole) {
|
||||
console.warn(error)
|
||||
} else {
|
||||
reject(error)
|
||||
}
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the svid of a user from their username
|
||||
* @function getSvidFromUsername
|
||||
* @param {string} username The username of the user
|
||||
* @param {boolean} errToConsole If there is an error, send it to console, instead of returning. Defaults to false
|
||||
* @returns {string} The data from the HTTP GET request, but because of the way it's handled, will always be a string (should be a string).
|
||||
* @author Brendan Lane <me@imbl.me>
|
||||
*/
|
||||
function getSvidFromUsername (username, errToConsole) {
|
||||
return new Promise((resolve, reject) => {
|
||||
axios.get(`${baseURL}/getSvidFromUsername?username=${username}`)
|
||||
.then(function (response) {
|
||||
resolve(response.data)
|
||||
})
|
||||
.catch(function (error) {
|
||||
if (errToConsole) {
|
||||
console.warn(error)
|
||||
} else {
|
||||
reject(error)
|
||||
}
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the username from their linked discord account
|
||||
* @function getUsernameFromDiscord
|
||||
* @param {string} discordid The discord User ID for the user account.
|
||||
* @param {boolean} errToConsole If there is an error, send it to console, instead of returning. Defaults to false
|
||||
* @returns {string} The data from the HTTP GET request, but because of the way it's handled, will always be a string (should be a string).
|
||||
* @author Brendan Lane <me@imbl.me>
|
||||
*/
|
||||
function getUsernameFromDiscord (discordid, errToConsole) {
|
||||
return new Promise((resolve, reject) => {
|
||||
axios.get(`${baseURL}/getUsernameFromDiscord?discordid=${discordid}`)
|
||||
.then(function (response) {
|
||||
resolve(response.data)
|
||||
})
|
||||
.catch(function (error) {
|
||||
if (errToConsole) {
|
||||
console.warn(error)
|
||||
} else {
|
||||
reject(error)
|
||||
}
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the SVID of a user who has their discord account linked.
|
||||
* @function getSvidFromDiscord
|
||||
* @param {string} discordid The discord user ID
|
||||
* @param {boolean} errToConsole If there is an error, send it to console, instead of returning. Defaults to false
|
||||
* @returns {string} The data from the HTTP GET request, but because of the way it's handled, will always be a string (should be a string).
|
||||
* @author Brendan Lane <me@imbl.me>
|
||||
*/
|
||||
function getSvidFromDiscord (discordid, errToConsole) {
|
||||
return new Promise((resolve, reject) => {
|
||||
axios.get(`${baseURL}/getSvidFromDiscord?discordid=${discordid}`)
|
||||
.then(function (response) {
|
||||
resolve(response.data)
|
||||
})
|
||||
.catch(function (error) {
|
||||
if (errToConsole) {
|
||||
console.warn(error)
|
||||
} else {
|
||||
reject(error)
|
||||
}
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the username from the minecraft UUID.
|
||||
* @function getUsernameFromMinecraft
|
||||
* @param {string} minecraftid The UUID of the minecraft user.
|
||||
* @param {boolean} errToConsole If there is an error, send it to console, instead of returning. Defaults to false
|
||||
* @returns {string} The data from the HTTP GET request, but because of the way it's handled, will always be a string (should be a string).
|
||||
* @author Brendan Lane <me@imbl.me>
|
||||
*/
|
||||
function getUsernameFromMinecraft (minecraftid, errToConsole) {
|
||||
return new Promise((resolve, reject) => {
|
||||
axios.get(`${baseURL}/getUsernameFromMinecraft?minecraftid=${minecraftid}`)
|
||||
.then(function (response) {
|
||||
resolve(response.data)
|
||||
})
|
||||
.catch(function (error) {
|
||||
if (errToConsole) {
|
||||
console.warn(error)
|
||||
} else {
|
||||
reject(error)
|
||||
}
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the SVID from the minecraft UUID.
|
||||
* @function getSvidFromMinecraft
|
||||
* @param {string} minecraftid The UUID of the minecraft user.
|
||||
* @param {boolean} errToConsole If there is an error, send it to console, instead of returning. Defaults to false
|
||||
* @returns {string} The data from the HTTP GET request, but because of the way it's handled, will always be a string (should be a string).
|
||||
* @author Brendan Lane <me@imbl.me>
|
||||
*/
|
||||
function getSvidFromMinecraft (minecraftid, errToConsole) {
|
||||
return new Promise((resolve, reject) => {
|
||||
axios.get(`${baseURL}/getSvidFromMinecraft?minecraftid=${minecraftid}`)
|
||||
.then(function (response) {
|
||||
resolve(response.data)
|
||||
})
|
||||
.catch(function (error) {
|
||||
if (errToConsole) {
|
||||
console.warn(error)
|
||||
} else {
|
||||
reject(error)
|
||||
}
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if the user has a discord role
|
||||
* @function hasDiscordRole
|
||||
* @param {string} userid The SVID of the user you want to lookup
|
||||
* @param {string} role The name of the role you want to lookup.
|
||||
* @param {boolean} errToConsole If there is an error, send it to console, instead of returning. Defaults to false
|
||||
* @returns {string} The data from the HTTP GET request, but because of the way it's handled, will always be a string (should be a boolean).
|
||||
* @author Brendan Lane <me@imbl.me>
|
||||
*/
|
||||
function hasDiscordRole (userid, role, errToConsole) {
|
||||
return new Promise((resolve, reject) => {
|
||||
axios.get(`${baseURL}/hasDiscordRole?userid=${userid}&role=${role}`)
|
||||
.then(function (response) {
|
||||
resolve(response.data)
|
||||
})
|
||||
.catch(function (error) {
|
||||
if (errToConsole) {
|
||||
console.warn(error)
|
||||
} else {
|
||||
reject(error)
|
||||
}
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the discord roles of a user
|
||||
* @function getDiscordRoles
|
||||
* @param {string} svid The svid of the user you want to lookup
|
||||
* @param {boolean} errToConsole If there is an error, send it to console, instead of returning. Defaults to false
|
||||
* @returns {string} The data from the HTTP GET request, but because of the way it's handled, will always be a string (should be a JSON Object).
|
||||
* @author Brendan Lane <me@imbl.me>
|
||||
*/
|
||||
function getDiscordRoles (svid, errToConsole) {
|
||||
return new Promise((resolve, reject) => {
|
||||
axios.get(`${baseURL}/getDiscordRoles?svid=${svid}`)
|
||||
.then(function (response) {
|
||||
resolve(response.data)
|
||||
})
|
||||
.catch(function (error) {
|
||||
if (errToConsole) {
|
||||
console.warn(error)
|
||||
} else {
|
||||
reject(error)
|
||||
}
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the days since the last move of a user
|
||||
* @function getDiscordRoles
|
||||
* @param {string} svid The svid of the user you want to lookup
|
||||
* @param {boolean} errToConsole If there is an error, send it to console, instead of returning. Defaults to false
|
||||
* @returns {string} The data from the HTTP GET request, but because of the way it's handled, will always be a string (should be a integer).
|
||||
* @author Brendan Lane <me@imbl.me>
|
||||
*/
|
||||
function getDaysSinceLastMove (svid, errToConsole) {
|
||||
return new Promise((resolve, reject) => {
|
||||
axios.get(`${baseURL}/getDaysSinceLastMove?svid=${svid}`)
|
||||
.then(function (response) {
|
||||
resolve(response.data)
|
||||
})
|
||||
.catch(function (error) {
|
||||
if (errToConsole) {
|
||||
console.warn(error)
|
||||
} else {
|
||||
reject(error)
|
||||
}
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
export default {
|
||||
getUser,
|
||||
getUsername,
|
||||
getSvidFromUsername,
|
||||
getUsernameFromDiscord,
|
||||
getSvidFromDiscord,
|
||||
getUsernameFromMinecraft,
|
||||
getSvidFromMinecraft,
|
||||
hasDiscordRole,
|
||||
getDiscordRoles,
|
||||
getDaysSinceLastMove
|
||||
}
|
301
modules/user.js
301
modules/user.js
|
@ -1,261 +1,170 @@
|
|||
// SpookVooper API - modules/user.js
|
||||
// Written by Brendan Lane
|
||||
// SpookVooper API - modules/User.js
|
||||
// Written by Brendan Lane - https://brndnln.dev
|
||||
|
||||
/** @module modules/user */
|
||||
import axios from 'axios'
|
||||
const axios = require('axios')
|
||||
const userURL = "https://api.spookvooper.com/user"
|
||||
const ecoURL = "https://api.spookvooper.com/eco"
|
||||
|
||||
const baseURL = 'https://api.spookvooper.com/user'
|
||||
class User {
|
||||
#apikey = undefined;
|
||||
|
||||
/**
|
||||
* Gets information on the user
|
||||
* @function getUser
|
||||
* @param {string} svid The svid for the user.
|
||||
* @param {boolean} errToConsole If there is an error, send it to console, instead of returning. Defaults to false
|
||||
* @returns {string} The data from the HTTP GET request, but because of the way it's handled, will always be a string (should be a JSON object).
|
||||
* @author Brendan Lane <me@imbl.me>
|
||||
*/
|
||||
function getUser (svid, errToConsole) {
|
||||
constructor(svid) {
|
||||
this.svid = svid
|
||||
|
||||
if (!this.svid.startsWith('u-')) {
|
||||
throw "Error: A user must have a 'u-' or else it is not a user!"
|
||||
}
|
||||
}
|
||||
|
||||
getUser() {
|
||||
return new Promise((resolve, reject) => {
|
||||
axios.get(`${baseURL}/getUser?svid=${svid}`)
|
||||
axios.get(`${userURL}/getUser?svid=${this.svid}`)
|
||||
.then(function (response) {
|
||||
resolve(response.data)
|
||||
resolve(response.data);
|
||||
})
|
||||
.catch(function (error) {
|
||||
if (errToConsole) {
|
||||
console.warn(error)
|
||||
} else {
|
||||
reject(error)
|
||||
reject(error);
|
||||
});
|
||||
});
|
||||
}
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the username of a user
|
||||
* @function getUsername
|
||||
* @param {string} svid The svid for the user lookup.
|
||||
* @param {boolean} errToConsole If there is an error, send it to console, instead of returning. Defaults to false
|
||||
* @returns {string} The data from the HTTP GET request, but because of the way it's handled, will always be a string (should be a string).
|
||||
* @author Brendan Lane <me@imbl.me>
|
||||
*/
|
||||
function getUsername (svid, errToConsole) {
|
||||
getUsername() {
|
||||
return new Promise((resolve, reject) => {
|
||||
axios.get(`${baseURL}/getUsername?svid=${svid}`)
|
||||
axios.get(`${userURL}/getUsername?svid=${this.svid}`)
|
||||
.then(function (response) {
|
||||
resolve(response.data)
|
||||
resolve(response.data);
|
||||
})
|
||||
.catch(function (error) {
|
||||
if (errToConsole) {
|
||||
console.warn(error)
|
||||
} else {
|
||||
reject(error)
|
||||
reject(error);
|
||||
});
|
||||
});
|
||||
}
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the svid of a user from their username
|
||||
* @function getSvidFromUsername
|
||||
* @param {string} username The username of the user
|
||||
* @param {boolean} errToConsole If there is an error, send it to console, instead of returning. Defaults to false
|
||||
* @returns {string} The data from the HTTP GET request, but because of the way it's handled, will always be a string (should be a string).
|
||||
* @author Brendan Lane <me@imbl.me>
|
||||
*/
|
||||
function getSvidFromUsername (username, errToConsole) {
|
||||
getBalance() {
|
||||
return new Promise((resolve, reject) => {
|
||||
axios.get(`${baseURL}/getSvidFromUsername?username=${username}`)
|
||||
axios.get(`${ecoURL}/getBalance?svid=${this.svid}`)
|
||||
.then(function (response) {
|
||||
resolve(response.data)
|
||||
resolve(response.data);
|
||||
})
|
||||
.catch(function (error) {
|
||||
if (errToConsole) {
|
||||
console.warn(error)
|
||||
} else {
|
||||
reject(error)
|
||||
reject(error);
|
||||
});
|
||||
});
|
||||
}
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the username from their linked discord account
|
||||
* @function getUsernameFromDiscord
|
||||
* @param {string} discordid The discord User ID for the user account.
|
||||
* @param {boolean} errToConsole If there is an error, send it to console, instead of returning. Defaults to false
|
||||
* @returns {string} The data from the HTTP GET request, but because of the way it's handled, will always be a string (should be a string).
|
||||
* @author Brendan Lane <me@imbl.me>
|
||||
*/
|
||||
function getUsernameFromDiscord (discordid, errToConsole) {
|
||||
hasDiscordRole(role) {
|
||||
return new Promise((resolve, reject) => {
|
||||
axios.get(`${baseURL}/getUsernameFromDiscord?discordid=${discordid}`)
|
||||
axios.get(`${userURL}/hasDiscordRole?userid=${this.svid}&role=${role}`)
|
||||
.then(function (response) {
|
||||
resolve(response.data)
|
||||
resolve(response.data);
|
||||
})
|
||||
.catch(function (error) {
|
||||
if (errToConsole) {
|
||||
console.warn(error)
|
||||
} else {
|
||||
reject(error)
|
||||
reject(error);
|
||||
});
|
||||
});
|
||||
}
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the SVID of a user who has their discord account linked.
|
||||
* @function getSvidFromDiscord
|
||||
* @param {string} discordid The discord user ID
|
||||
* @param {boolean} errToConsole If there is an error, send it to console, instead of returning. Defaults to false
|
||||
* @returns {string} The data from the HTTP GET request, but because of the way it's handled, will always be a string (should be a string).
|
||||
* @author Brendan Lane <me@imbl.me>
|
||||
*/
|
||||
function getSvidFromDiscord (discordid, errToConsole) {
|
||||
getDiscordRoles() {
|
||||
return new Promise((resolve, reject) => {
|
||||
axios.get(`${baseURL}/getSvidFromDiscord?discordid=${discordid}`)
|
||||
axios.get(`${userURL}/getDiscordRoles?svid=${this.svid}`)
|
||||
.then(function (response) {
|
||||
resolve(response.data)
|
||||
resolve(response.data);
|
||||
})
|
||||
.catch(function (error) {
|
||||
if (errToConsole) {
|
||||
console.warn(error)
|
||||
} else {
|
||||
reject(error)
|
||||
reject(error);
|
||||
});
|
||||
});
|
||||
}
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the username from the minecraft UUID.
|
||||
* @function getUsernameFromMinecraft
|
||||
* @param {string} minecraftid The UUID of the minecraft user.
|
||||
* @param {boolean} errToConsole If there is an error, send it to console, instead of returning. Defaults to false
|
||||
* @returns {string} The data from the HTTP GET request, but because of the way it's handled, will always be a string (should be a string).
|
||||
* @author Brendan Lane <me@imbl.me>
|
||||
*/
|
||||
function getUsernameFromMinecraft (minecraftid, errToConsole) {
|
||||
getDaysSinceLastMove() {
|
||||
return new Promise((resolve, reject) => {
|
||||
axios.get(`${baseURL}/getUsernameFromMinecraft?minecraftid=${minecraftid}`)
|
||||
axios.get(`${userURL}/getDaysSinceLastMove?svid=${this.svid}`)
|
||||
.then(function (response) {
|
||||
resolve(response.data)
|
||||
resolve(response.data);
|
||||
})
|
||||
.catch(function (error) {
|
||||
if (errToConsole) {
|
||||
console.warn(error)
|
||||
} else {
|
||||
reject(error)
|
||||
reject(error);
|
||||
});
|
||||
});
|
||||
}
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the SVID from the minecraft UUID.
|
||||
* @function getSvidFromMinecraft
|
||||
* @param {string} minecraftid The UUID of the minecraft user.
|
||||
* @param {boolean} errToConsole If there is an error, send it to console, instead of returning. Defaults to false
|
||||
* @returns {string} The data from the HTTP GET request, but because of the way it's handled, will always be a string (should be a string).
|
||||
* @author Brendan Lane <me@imbl.me>
|
||||
*/
|
||||
function getSvidFromMinecraft (minecraftid, errToConsole) {
|
||||
set setApiKey(key) {
|
||||
this.#apikey = key;
|
||||
}
|
||||
|
||||
sendCredits(amount, to, reason) {
|
||||
if (typeof to === "string") {
|
||||
return new Promise((resolve, reject) => {
|
||||
axios.get(`${baseURL}/getSvidFromMinecraft?minecraftid=${minecraftid}`)
|
||||
axios.get(`${ecoURL}/sendTransactionByIds?from=${this.svid}&to=${to}&amount=${amount}&auth=${this.#apikey}&detail=${reason}`)
|
||||
.then(function (response) {
|
||||
resolve(response.data)
|
||||
resolve(response.data);
|
||||
})
|
||||
.catch(function (error) {
|
||||
if (errToConsole) {
|
||||
console.warn(error)
|
||||
} else {
|
||||
reject(error)
|
||||
}
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if the user has a discord role
|
||||
* @function hasDiscordRole
|
||||
* @param {string} userid The SVID of the user you want to lookup
|
||||
* @param {string} role The name of the role you want to lookup.
|
||||
* @param {boolean} errToConsole If there is an error, send it to console, instead of returning. Defaults to false
|
||||
* @returns {string} The data from the HTTP GET request, but because of the way it's handled, will always be a string (should be a boolean).
|
||||
* @author Brendan Lane <me@imbl.me>
|
||||
*/
|
||||
function hasDiscordRole (userid, role, errToConsole) {
|
||||
reject(error);
|
||||
});
|
||||
});
|
||||
} else if (typeof to === "object") {
|
||||
return new Promise((resolve, reject) => {
|
||||
axios.get(`${baseURL}/hasDiscordRole?userid=${userid}&role=${role}`)
|
||||
axios.get(`${ecoURL}/sendTransactionByIds?from=${this.svid}&to=${to.svid}&amount=${amount}&auth=${this.#apikey}&detail=${reason}`)
|
||||
.then(function (response) {
|
||||
resolve(response.data)
|
||||
resolve(response.data);
|
||||
})
|
||||
.catch(function (error) {
|
||||
if (errToConsole) {
|
||||
console.warn(error)
|
||||
reject(error);
|
||||
});
|
||||
});
|
||||
} else {
|
||||
reject(error)
|
||||
throw "The 'to' parameter must be a string or an object!";
|
||||
}
|
||||
}
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the discord roles of a user
|
||||
* @function getDiscordRoles
|
||||
* @param {string} svid The svid of the user you want to lookup
|
||||
* @param {boolean} errToConsole If there is an error, send it to console, instead of returning. Defaults to false
|
||||
* @returns {string} The data from the HTTP GET request, but because of the way it's handled, will always be a string (should be a JSON Object).
|
||||
* @author Brendan Lane <me@imbl.me>
|
||||
*/
|
||||
function getDiscordRoles (svid, errToConsole) {
|
||||
getUserStockOffers(ticker) {
|
||||
return new Promise((resolve, reject) => {
|
||||
axios.get(`${baseURL}/getDiscordRoles?svid=${svid}`)
|
||||
axios.get(`${ecoURL}/getUserStockOffers?ticker=${ticker}&svid=${this.svid}`)
|
||||
.then(function (response) {
|
||||
resolve(response.data)
|
||||
resolve(response.data);
|
||||
})
|
||||
.catch(function (error) {
|
||||
if (errToConsole) {
|
||||
console.warn(error)
|
||||
} else {
|
||||
reject(error)
|
||||
reject(error);
|
||||
});
|
||||
});
|
||||
}
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the days since the last move of a user
|
||||
* @function getDiscordRoles
|
||||
* @param {string} svid The svid of the user you want to lookup
|
||||
* @param {boolean} errToConsole If there is an error, send it to console, instead of returning. Defaults to false
|
||||
* @returns {string} The data from the HTTP GET request, but because of the way it's handled, will always be a string (should be a integer).
|
||||
* @author Brendan Lane <me@imbl.me>
|
||||
*/
|
||||
function getDaysSinceLastMove (svid, errToConsole) {
|
||||
buyStock(ticker, amount, price) {
|
||||
return new Promise((resolve, reject) => {
|
||||
axios.get(`${baseURL}/getDaysSinceLastMove?svid=${svid}`)
|
||||
axios.get(`${ecoURL}/submitStockBuy?ticker=${ticker}&count=${amount}&price=${price}&accountid=${this.svid}&auth=${this.#apikey}`)
|
||||
.then(function (response) {
|
||||
resolve(response.data)
|
||||
resolve(response.data);
|
||||
})
|
||||
.catch(function (error) {
|
||||
if (errToConsole) {
|
||||
console.warn(error)
|
||||
} else {
|
||||
reject(error)
|
||||
reject(error);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
sellStock(ticker, amount, price) {
|
||||
return new Promise((resolve, reject) => {
|
||||
axios.get(`${ecoURL}/submitStockSell?ticker=${ticker}&count=${amount}&price=${price}&accountid=${this.svid}&auth=${this.#apikey}`)
|
||||
.then(function (response) {
|
||||
resolve(response.data);
|
||||
})
|
||||
.catch(function (error) {
|
||||
reject(error);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
cancelStockOrder(orderid) {
|
||||
return new Promise((resolve, reject) => {
|
||||
axios.get(`${ecoURL}/cancelOrder?orderid=${orderid}&accountid=${this.svid}&auth=${this.#apikey}`)
|
||||
.then(function (response) {
|
||||
resolve(response.data);
|
||||
})
|
||||
.catch(function (error) {
|
||||
reject(error);
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
export default {
|
||||
getUser,
|
||||
getUsername,
|
||||
getSvidFromUsername,
|
||||
getUsernameFromDiscord,
|
||||
getSvidFromDiscord,
|
||||
getUsernameFromMinecraft,
|
||||
getSvidFromMinecraft,
|
||||
hasDiscordRole,
|
||||
getDiscordRoles,
|
||||
getDaysSinceLastMove
|
||||
}
|
||||
module.exports = User
|
|
@ -1,14 +1,15 @@
|
|||
{
|
||||
"name": "spookvooperapi",
|
||||
"name": "@vexico/spookvooperapi",
|
||||
"version": "1.3.0",
|
||||
"lockfileVersion": 2,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "spookvooperapi",
|
||||
"name": "@vexico/spookvooperapi",
|
||||
"version": "1.3.0",
|
||||
"license": "SEE LICENSE IN LICENSE",
|
||||
"dependencies": {
|
||||
"@microsoft/signalr": "^5.0.0",
|
||||
"axios": "^0.20.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
|
@ -178,12 +179,35 @@
|
|||
"node": "^10.12.0 || >=12.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@microsoft/signalr": {
|
||||
"version": "5.0.0",
|
||||
"resolved": "https://registry.npmjs.org/@microsoft/signalr/-/signalr-5.0.0.tgz",
|
||||
"integrity": "sha512-AsbU1ZB4Q9JsZ77W13VGT8gi/cVrFn3XbvVfULSwrC9DVCXF2JpkBDh0cCmRaYs9M3kqKohiVM1WPqNeAGil/g==",
|
||||
"dependencies": {
|
||||
"abort-controller": "^3.0.0",
|
||||
"eventsource": "^1.0.7",
|
||||
"fetch-cookie": "^0.7.3",
|
||||
"node-fetch": "^2.6.0",
|
||||
"ws": "^6.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@types/color-name": {
|
||||
"version": "1.1.1",
|
||||
"resolved": "https://registry.npmjs.org/@types/color-name/-/color-name-1.1.1.tgz",
|
||||
"integrity": "sha512-rr+OQyAjxze7GgWrSaJwydHStIhHq2lvY3BOC2Mj7KnzI7XK0Uw1TOOdI9lDoajEbSWLiYgoo4f1R51erQfhPQ==",
|
||||
"dev": true
|
||||
},
|
||||
"node_modules/abort-controller": {
|
||||
"version": "3.0.0",
|
||||
"resolved": "https://registry.npmjs.org/abort-controller/-/abort-controller-3.0.0.tgz",
|
||||
"integrity": "sha512-h8lQ8tacZYnR3vNQTgibj+tODHI5/+l06Au2Pcriv/Gmet0eaj4TwWH41sO9wnHDiQsEj19q0drzdWdeAHtweg==",
|
||||
"dependencies": {
|
||||
"event-target-shim": "^5.0.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=6.5"
|
||||
}
|
||||
},
|
||||
"node_modules/acorn": {
|
||||
"version": "7.4.0",
|
||||
"resolved": "https://registry.npmjs.org/acorn/-/acorn-7.4.0.tgz",
|
||||
|
@ -262,6 +286,11 @@
|
|||
"node": ">=4"
|
||||
}
|
||||
},
|
||||
"node_modules/async-limiter": {
|
||||
"version": "1.0.1",
|
||||
"resolved": "https://registry.npmjs.org/async-limiter/-/async-limiter-1.0.1.tgz",
|
||||
"integrity": "sha512-csOlWGAcRFJaI6m+F2WKdnMKr4HhdhFVBk0H/QbJFMCr+uO2kwohwXQPxw/9OCxp05r5ghVBFSyioixx3gfkNQ=="
|
||||
},
|
||||
"node_modules/axios": {
|
||||
"version": "0.20.0",
|
||||
"resolved": "https://registry.npmjs.org/axios/-/axios-0.20.0.tgz",
|
||||
|
@ -460,6 +489,11 @@
|
|||
"node": ">=8.6"
|
||||
}
|
||||
},
|
||||
"node_modules/es6-denodeify": {
|
||||
"version": "0.1.5",
|
||||
"resolved": "https://registry.npmjs.org/es6-denodeify/-/es6-denodeify-0.1.5.tgz",
|
||||
"integrity": "sha1-MdTV/pxVA+ElRgQ5MQ4WoqPznB8="
|
||||
},
|
||||
"node_modules/escape-string-regexp": {
|
||||
"version": "1.0.5",
|
||||
"resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz",
|
||||
|
@ -641,6 +675,25 @@
|
|||
"node": ">=0.10.0"
|
||||
}
|
||||
},
|
||||
"node_modules/event-target-shim": {
|
||||
"version": "5.0.1",
|
||||
"resolved": "https://registry.npmjs.org/event-target-shim/-/event-target-shim-5.0.1.tgz",
|
||||
"integrity": "sha512-i/2XbnSz/uxRCU6+NdVJgKWDTM427+MqYbkQzD321DuCQJUqOuJKIA0IM2+W2xtYHdKOmZ4dR6fExsd4SXL+WQ==",
|
||||
"engines": {
|
||||
"node": ">=6"
|
||||
}
|
||||
},
|
||||
"node_modules/eventsource": {
|
||||
"version": "1.0.7",
|
||||
"resolved": "https://registry.npmjs.org/eventsource/-/eventsource-1.0.7.tgz",
|
||||
"integrity": "sha512-4Ln17+vVT0k8aWq+t/bF5arcS3EpT9gYtW66EPacdj/mAFevznsnyoHLPy2BA8gbIQeIHoPsvwmfBftfcG//BQ==",
|
||||
"dependencies": {
|
||||
"original": "^1.0.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=0.12.0"
|
||||
}
|
||||
},
|
||||
"node_modules/fast-deep-equal": {
|
||||
"version": "3.1.3",
|
||||
"resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz",
|
||||
|
@ -659,6 +712,15 @@
|
|||
"integrity": "sha1-PYpcZog6FqMMqGQ+hR8Zuqd5eRc=",
|
||||
"dev": true
|
||||
},
|
||||
"node_modules/fetch-cookie": {
|
||||
"version": "0.7.3",
|
||||
"resolved": "https://registry.npmjs.org/fetch-cookie/-/fetch-cookie-0.7.3.tgz",
|
||||
"integrity": "sha512-rZPkLnI8x5V+zYAiz8QonAHsTb4BY+iFowFBI1RFn0zrO343AVp9X7/yUj/9wL6Ef/8fLls8b/vGtzUvmyAUGA==",
|
||||
"dependencies": {
|
||||
"es6-denodeify": "^0.1.1",
|
||||
"tough-cookie": "^2.3.3"
|
||||
}
|
||||
},
|
||||
"node_modules/file-entry-cache": {
|
||||
"version": "5.0.1",
|
||||
"resolved": "https://registry.npmjs.org/file-entry-cache/-/file-entry-cache-5.0.1.tgz",
|
||||
|
@ -978,6 +1040,14 @@
|
|||
"integrity": "sha1-Sr6/7tdUHywnrPspvbvRXI1bpPc=",
|
||||
"dev": true
|
||||
},
|
||||
"node_modules/node-fetch": {
|
||||
"version": "2.6.1",
|
||||
"resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.1.tgz",
|
||||
"integrity": "sha512-V4aYg89jEoVRxRb2fJdAg8FHvI7cEyYdVAh94HH0UIK8oJxUfkjlDQN9RbMx+bEjP7+ggMiFRprSti032Oipxw==",
|
||||
"engines": {
|
||||
"node": "4.x || >=6.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/once": {
|
||||
"version": "1.4.0",
|
||||
"resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz",
|
||||
|
@ -1004,6 +1074,14 @@
|
|||
"node": ">= 0.8.0"
|
||||
}
|
||||
},
|
||||
"node_modules/original": {
|
||||
"version": "1.0.2",
|
||||
"resolved": "https://registry.npmjs.org/original/-/original-1.0.2.tgz",
|
||||
"integrity": "sha512-hyBVl6iqqUOJ8FqRe+l/gS8H+kKYjrEndd5Pm1MfBtsEKA038HkkdbAl/72EAXGyonD/PFsvmVG+EvcIpliMBg==",
|
||||
"dependencies": {
|
||||
"url-parse": "^1.4.3"
|
||||
}
|
||||
},
|
||||
"node_modules/parent-module": {
|
||||
"version": "1.0.1",
|
||||
"resolved": "https://registry.npmjs.org/parent-module/-/parent-module-1.0.1.tgz",
|
||||
|
@ -1070,15 +1148,24 @@
|
|||
"node": ">=0.4.0"
|
||||
}
|
||||
},
|
||||
"node_modules/psl": {
|
||||
"version": "1.8.0",
|
||||
"resolved": "https://registry.npmjs.org/psl/-/psl-1.8.0.tgz",
|
||||
"integrity": "sha512-RIdOzyoavK+hA18OGGWDqUTsCLhtA7IcZ/6NCs4fFJaHBDab+pDDmDIByWFRQJq2Cd7r1OoQxBGKOaztq+hjIQ=="
|
||||
},
|
||||
"node_modules/punycode": {
|
||||
"version": "2.1.1",
|
||||
"resolved": "https://registry.npmjs.org/punycode/-/punycode-2.1.1.tgz",
|
||||
"integrity": "sha512-XRsRjdf+j5ml+y/6GKHPZbrF/8p2Yga0JPtdqTIY2Xe5ohJPD9saDJJLPvp9+NSBprVvevdXZybnj2cv8OEd0A==",
|
||||
"dev": true,
|
||||
"engines": {
|
||||
"node": ">=6"
|
||||
}
|
||||
},
|
||||
"node_modules/querystringify": {
|
||||
"version": "2.2.0",
|
||||
"resolved": "https://registry.npmjs.org/querystringify/-/querystringify-2.2.0.tgz",
|
||||
"integrity": "sha512-FIqgj2EUvTa7R50u0rGsyTftzjYmv/a3hO345bZNrqabNqjtgiDMgmo4mkUjd+nzU5oF3dClKqFIPUKybUyqoQ=="
|
||||
},
|
||||
"node_modules/regexpp": {
|
||||
"version": "3.1.0",
|
||||
"resolved": "https://registry.npmjs.org/regexpp/-/regexpp-3.1.0.tgz",
|
||||
|
@ -1088,6 +1175,11 @@
|
|||
"node": ">=8"
|
||||
}
|
||||
},
|
||||
"node_modules/requires-port": {
|
||||
"version": "1.0.0",
|
||||
"resolved": "https://registry.npmjs.org/requires-port/-/requires-port-1.0.0.tgz",
|
||||
"integrity": "sha1-kl0mAdOaxIXgkc8NpcbmlNw9yv8="
|
||||
},
|
||||
"node_modules/resolve": {
|
||||
"version": "1.19.0",
|
||||
"resolved": "https://registry.npmjs.org/resolve/-/resolve-1.19.0.tgz",
|
||||
|
@ -1282,6 +1374,18 @@
|
|||
"node": ">=4"
|
||||
}
|
||||
},
|
||||
"node_modules/tough-cookie": {
|
||||
"version": "2.5.0",
|
||||
"resolved": "https://registry.npmjs.org/tough-cookie/-/tough-cookie-2.5.0.tgz",
|
||||
"integrity": "sha512-nlLsUzgm1kfLXSXfRZMc1KLAugd4hqJHDTvc2hDIwS3mZAfMEuMbc03SujMF+GEcpaX/qboeycw6iO8JwVv2+g==",
|
||||
"dependencies": {
|
||||
"psl": "^1.1.28",
|
||||
"punycode": "^2.1.1"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=0.8"
|
||||
}
|
||||
},
|
||||
"node_modules/type-check": {
|
||||
"version": "0.4.0",
|
||||
"resolved": "https://registry.npmjs.org/type-check/-/type-check-0.4.0.tgz",
|
||||
|
@ -1312,6 +1416,15 @@
|
|||
"punycode": "^2.1.0"
|
||||
}
|
||||
},
|
||||
"node_modules/url-parse": {
|
||||
"version": "1.4.7",
|
||||
"resolved": "https://registry.npmjs.org/url-parse/-/url-parse-1.4.7.tgz",
|
||||
"integrity": "sha512-d3uaVyzDB9tQoSXFvuSUNFibTd9zxd2bkVrDRvF5TmvWWQwqE4lgYJ5m+x1DbecWkw+LK4RNl2CU1hHuOKPVlg==",
|
||||
"dependencies": {
|
||||
"querystringify": "^2.1.1",
|
||||
"requires-port": "^1.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/v8-compile-cache": {
|
||||
"version": "2.1.1",
|
||||
"resolved": "https://registry.npmjs.org/v8-compile-cache/-/v8-compile-cache-2.1.1.tgz",
|
||||
|
@ -1359,6 +1472,14 @@
|
|||
"engines": {
|
||||
"node": ">=4"
|
||||
}
|
||||
},
|
||||
"node_modules/ws": {
|
||||
"version": "6.2.1",
|
||||
"resolved": "https://registry.npmjs.org/ws/-/ws-6.2.1.tgz",
|
||||
"integrity": "sha512-GIyAXC2cB7LjvpgMt9EKS2ldqr0MTrORaleiOno6TweZ6r3TKtoFQWay/2PceJ3RuBasOHzXNn5Lrw1X0bEjqA==",
|
||||
"dependencies": {
|
||||
"async-limiter": "~1.0.0"
|
||||
}
|
||||
}
|
||||
},
|
||||
"dependencies": {
|
||||
|
@ -1512,12 +1633,32 @@
|
|||
"strip-json-comments": "^3.1.1"
|
||||
}
|
||||
},
|
||||
"@microsoft/signalr": {
|
||||
"version": "5.0.0",
|
||||
"resolved": "https://registry.npmjs.org/@microsoft/signalr/-/signalr-5.0.0.tgz",
|
||||
"integrity": "sha512-AsbU1ZB4Q9JsZ77W13VGT8gi/cVrFn3XbvVfULSwrC9DVCXF2JpkBDh0cCmRaYs9M3kqKohiVM1WPqNeAGil/g==",
|
||||
"requires": {
|
||||
"abort-controller": "^3.0.0",
|
||||
"eventsource": "^1.0.7",
|
||||
"fetch-cookie": "^0.7.3",
|
||||
"node-fetch": "^2.6.0",
|
||||
"ws": "^6.0.0"
|
||||
}
|
||||
},
|
||||
"@types/color-name": {
|
||||
"version": "1.1.1",
|
||||
"resolved": "https://registry.npmjs.org/@types/color-name/-/color-name-1.1.1.tgz",
|
||||
"integrity": "sha512-rr+OQyAjxze7GgWrSaJwydHStIhHq2lvY3BOC2Mj7KnzI7XK0Uw1TOOdI9lDoajEbSWLiYgoo4f1R51erQfhPQ==",
|
||||
"dev": true
|
||||
},
|
||||
"abort-controller": {
|
||||
"version": "3.0.0",
|
||||
"resolved": "https://registry.npmjs.org/abort-controller/-/abort-controller-3.0.0.tgz",
|
||||
"integrity": "sha512-h8lQ8tacZYnR3vNQTgibj+tODHI5/+l06Au2Pcriv/Gmet0eaj4TwWH41sO9wnHDiQsEj19q0drzdWdeAHtweg==",
|
||||
"requires": {
|
||||
"event-target-shim": "^5.0.0"
|
||||
}
|
||||
},
|
||||
"acorn": {
|
||||
"version": "7.4.0",
|
||||
"resolved": "https://registry.npmjs.org/acorn/-/acorn-7.4.0.tgz",
|
||||
|
@ -1578,6 +1719,11 @@
|
|||
"integrity": "sha512-+Ryf6g3BKoRc7jfp7ad8tM4TtMiaWvbF/1/sQcZPkkS7ag3D5nMBCe2UfOTONtAkaG0tO0ij3C5Lwmf1EiyjHg==",
|
||||
"dev": true
|
||||
},
|
||||
"async-limiter": {
|
||||
"version": "1.0.1",
|
||||
"resolved": "https://registry.npmjs.org/async-limiter/-/async-limiter-1.0.1.tgz",
|
||||
"integrity": "sha512-csOlWGAcRFJaI6m+F2WKdnMKr4HhdhFVBk0H/QbJFMCr+uO2kwohwXQPxw/9OCxp05r5ghVBFSyioixx3gfkNQ=="
|
||||
},
|
||||
"axios": {
|
||||
"version": "0.20.0",
|
||||
"resolved": "https://registry.npmjs.org/axios/-/axios-0.20.0.tgz",
|
||||
|
@ -1745,6 +1891,11 @@
|
|||
"ansi-colors": "^4.1.1"
|
||||
}
|
||||
},
|
||||
"es6-denodeify": {
|
||||
"version": "0.1.5",
|
||||
"resolved": "https://registry.npmjs.org/es6-denodeify/-/es6-denodeify-0.1.5.tgz",
|
||||
"integrity": "sha1-MdTV/pxVA+ElRgQ5MQ4WoqPznB8="
|
||||
},
|
||||
"escape-string-regexp": {
|
||||
"version": "1.0.5",
|
||||
"resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz",
|
||||
|
@ -1884,6 +2035,19 @@
|
|||
"integrity": "sha512-kVscqXk4OCp68SZ0dkgEKVi6/8ij300KBWTJq32P/dYeWTSwK41WyTxalN1eRmA5Z9UU/LX9D7FWSmV9SAYx6g==",
|
||||
"dev": true
|
||||
},
|
||||
"event-target-shim": {
|
||||
"version": "5.0.1",
|
||||
"resolved": "https://registry.npmjs.org/event-target-shim/-/event-target-shim-5.0.1.tgz",
|
||||
"integrity": "sha512-i/2XbnSz/uxRCU6+NdVJgKWDTM427+MqYbkQzD321DuCQJUqOuJKIA0IM2+W2xtYHdKOmZ4dR6fExsd4SXL+WQ=="
|
||||
},
|
||||
"eventsource": {
|
||||
"version": "1.0.7",
|
||||
"resolved": "https://registry.npmjs.org/eventsource/-/eventsource-1.0.7.tgz",
|
||||
"integrity": "sha512-4Ln17+vVT0k8aWq+t/bF5arcS3EpT9gYtW66EPacdj/mAFevznsnyoHLPy2BA8gbIQeIHoPsvwmfBftfcG//BQ==",
|
||||
"requires": {
|
||||
"original": "^1.0.0"
|
||||
}
|
||||
},
|
||||
"fast-deep-equal": {
|
||||
"version": "3.1.3",
|
||||
"resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz",
|
||||
|
@ -1902,6 +2066,15 @@
|
|||
"integrity": "sha1-PYpcZog6FqMMqGQ+hR8Zuqd5eRc=",
|
||||
"dev": true
|
||||
},
|
||||
"fetch-cookie": {
|
||||
"version": "0.7.3",
|
||||
"resolved": "https://registry.npmjs.org/fetch-cookie/-/fetch-cookie-0.7.3.tgz",
|
||||
"integrity": "sha512-rZPkLnI8x5V+zYAiz8QonAHsTb4BY+iFowFBI1RFn0zrO343AVp9X7/yUj/9wL6Ef/8fLls8b/vGtzUvmyAUGA==",
|
||||
"requires": {
|
||||
"es6-denodeify": "^0.1.1",
|
||||
"tough-cookie": "^2.3.3"
|
||||
}
|
||||
},
|
||||
"file-entry-cache": {
|
||||
"version": "5.0.1",
|
||||
"resolved": "https://registry.npmjs.org/file-entry-cache/-/file-entry-cache-5.0.1.tgz",
|
||||
|
@ -2158,6 +2331,11 @@
|
|||
"integrity": "sha1-Sr6/7tdUHywnrPspvbvRXI1bpPc=",
|
||||
"dev": true
|
||||
},
|
||||
"node-fetch": {
|
||||
"version": "2.6.1",
|
||||
"resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.1.tgz",
|
||||
"integrity": "sha512-V4aYg89jEoVRxRb2fJdAg8FHvI7cEyYdVAh94HH0UIK8oJxUfkjlDQN9RbMx+bEjP7+ggMiFRprSti032Oipxw=="
|
||||
},
|
||||
"once": {
|
||||
"version": "1.4.0",
|
||||
"resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz",
|
||||
|
@ -2181,6 +2359,14 @@
|
|||
"word-wrap": "^1.2.3"
|
||||
}
|
||||
},
|
||||
"original": {
|
||||
"version": "1.0.2",
|
||||
"resolved": "https://registry.npmjs.org/original/-/original-1.0.2.tgz",
|
||||
"integrity": "sha512-hyBVl6iqqUOJ8FqRe+l/gS8H+kKYjrEndd5Pm1MfBtsEKA038HkkdbAl/72EAXGyonD/PFsvmVG+EvcIpliMBg==",
|
||||
"requires": {
|
||||
"url-parse": "^1.4.3"
|
||||
}
|
||||
},
|
||||
"parent-module": {
|
||||
"version": "1.0.1",
|
||||
"resolved": "https://registry.npmjs.org/parent-module/-/parent-module-1.0.1.tgz",
|
||||
|
@ -2226,11 +2412,20 @@
|
|||
"integrity": "sha512-7PiHtLll5LdnKIMw100I+8xJXR5gW2QwWYkT6iJva0bXitZKa/XMrSbdmg3r2Xnaidz9Qumd0VPaMrZlF9V9sA==",
|
||||
"dev": true
|
||||
},
|
||||
"psl": {
|
||||
"version": "1.8.0",
|
||||
"resolved": "https://registry.npmjs.org/psl/-/psl-1.8.0.tgz",
|
||||
"integrity": "sha512-RIdOzyoavK+hA18OGGWDqUTsCLhtA7IcZ/6NCs4fFJaHBDab+pDDmDIByWFRQJq2Cd7r1OoQxBGKOaztq+hjIQ=="
|
||||
},
|
||||
"punycode": {
|
||||
"version": "2.1.1",
|
||||
"resolved": "https://registry.npmjs.org/punycode/-/punycode-2.1.1.tgz",
|
||||
"integrity": "sha512-XRsRjdf+j5ml+y/6GKHPZbrF/8p2Yga0JPtdqTIY2Xe5ohJPD9saDJJLPvp9+NSBprVvevdXZybnj2cv8OEd0A==",
|
||||
"dev": true
|
||||
"integrity": "sha512-XRsRjdf+j5ml+y/6GKHPZbrF/8p2Yga0JPtdqTIY2Xe5ohJPD9saDJJLPvp9+NSBprVvevdXZybnj2cv8OEd0A=="
|
||||
},
|
||||
"querystringify": {
|
||||
"version": "2.2.0",
|
||||
"resolved": "https://registry.npmjs.org/querystringify/-/querystringify-2.2.0.tgz",
|
||||
"integrity": "sha512-FIqgj2EUvTa7R50u0rGsyTftzjYmv/a3hO345bZNrqabNqjtgiDMgmo4mkUjd+nzU5oF3dClKqFIPUKybUyqoQ=="
|
||||
},
|
||||
"regexpp": {
|
||||
"version": "3.1.0",
|
||||
|
@ -2238,6 +2433,11 @@
|
|||
"integrity": "sha512-ZOIzd8yVsQQA7j8GCSlPGXwg5PfmA1mrq0JP4nGhh54LaKN3xdai/vHUDu74pKwV8OxseMS65u2NImosQcSD0Q==",
|
||||
"dev": true
|
||||
},
|
||||
"requires-port": {
|
||||
"version": "1.0.0",
|
||||
"resolved": "https://registry.npmjs.org/requires-port/-/requires-port-1.0.0.tgz",
|
||||
"integrity": "sha1-kl0mAdOaxIXgkc8NpcbmlNw9yv8="
|
||||
},
|
||||
"resolve": {
|
||||
"version": "1.19.0",
|
||||
"resolved": "https://registry.npmjs.org/resolve/-/resolve-1.19.0.tgz",
|
||||
|
@ -2383,6 +2583,15 @@
|
|||
"integrity": "sha1-3F5pjL0HkmW8c+A3doGk5Og/YW4=",
|
||||
"dev": true
|
||||
},
|
||||
"tough-cookie": {
|
||||
"version": "2.5.0",
|
||||
"resolved": "https://registry.npmjs.org/tough-cookie/-/tough-cookie-2.5.0.tgz",
|
||||
"integrity": "sha512-nlLsUzgm1kfLXSXfRZMc1KLAugd4hqJHDTvc2hDIwS3mZAfMEuMbc03SujMF+GEcpaX/qboeycw6iO8JwVv2+g==",
|
||||
"requires": {
|
||||
"psl": "^1.1.28",
|
||||
"punycode": "^2.1.1"
|
||||
}
|
||||
},
|
||||
"type-check": {
|
||||
"version": "0.4.0",
|
||||
"resolved": "https://registry.npmjs.org/type-check/-/type-check-0.4.0.tgz",
|
||||
|
@ -2407,6 +2616,15 @@
|
|||
"punycode": "^2.1.0"
|
||||
}
|
||||
},
|
||||
"url-parse": {
|
||||
"version": "1.4.7",
|
||||
"resolved": "https://registry.npmjs.org/url-parse/-/url-parse-1.4.7.tgz",
|
||||
"integrity": "sha512-d3uaVyzDB9tQoSXFvuSUNFibTd9zxd2bkVrDRvF5TmvWWQwqE4lgYJ5m+x1DbecWkw+LK4RNl2CU1hHuOKPVlg==",
|
||||
"requires": {
|
||||
"querystringify": "^2.1.1",
|
||||
"requires-port": "^1.0.0"
|
||||
}
|
||||
},
|
||||
"v8-compile-cache": {
|
||||
"version": "2.1.1",
|
||||
"resolved": "https://registry.npmjs.org/v8-compile-cache/-/v8-compile-cache-2.1.1.tgz",
|
||||
|
@ -2442,6 +2660,14 @@
|
|||
"requires": {
|
||||
"mkdirp": "^0.5.1"
|
||||
}
|
||||
},
|
||||
"ws": {
|
||||
"version": "6.2.1",
|
||||
"resolved": "https://registry.npmjs.org/ws/-/ws-6.2.1.tgz",
|
||||
"integrity": "sha512-GIyAXC2cB7LjvpgMt9EKS2ldqr0MTrORaleiOno6TweZ6r3TKtoFQWay/2PceJ3RuBasOHzXNn5Lrw1X0bEjqA==",
|
||||
"requires": {
|
||||
"async-limiter": "~1.0.0"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
{
|
||||
"name": "spookvooperapi",
|
||||
"name": "@vexico/spookvooperapi",
|
||||
"version": "1.3.0",
|
||||
"description": "Easy to use library for the SpookVooper API",
|
||||
"main": "main.js",
|
||||
|
@ -7,6 +7,9 @@
|
|||
"scripts": {
|
||||
"test": "node main.js"
|
||||
},
|
||||
"publishConfig": {
|
||||
"registry": "https://npm.pkg.github.com/"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/vexico/spookvooper-api.git"
|
||||
|
@ -24,6 +27,7 @@
|
|||
"prettier": "^2.1.1"
|
||||
},
|
||||
"dependencies": {
|
||||
"@microsoft/signalr": "^5.0.0",
|
||||
"axios": "^0.20.0"
|
||||
},
|
||||
"bugs": {
|
||||
|
|
Loading…
Reference in New Issue