OpenDeck/types/index.js

28 lines
604 B
JavaScript
Raw Permalink Normal View History

2021-03-08 19:42:32 +01:00
const db = require("../db.json");
const types = {
"execCommand": require("./ExecCommand"),
"deck": require("./Deck"),
"keys": require("./Keys"),
"obs": require("./OBS")
2021-03-08 19:42:32 +01:00
};
module.exports.types = types;
/**
*
* @param name
* @param x
* @param y
* @returns {null|Base}
*/
module.exports.getSlot = (name, x, y) => {
if (name in db.decks)
if (x in db.decks[name].rows)
if (y in db.decks[name].rows[x]) {
let d = db.decks[name].rows[x][y];
return new types[d.type](d.text, d.image, d.options);
}
return null;
};