discord-prefix
Version:
A simple Node.js module that lets you easily manage custom prefixes for your discord bot
14 lines (9 loc) • 389 B
JavaScript
const get = require('./lg');
module.exports = function(db, params, options) {
let fetched = db.prepare(`SELECT * FROM ${options.table} WHERE ID = (?)`).get(params.id);
if (!fetched) return null;
fetched = JSON.parse(fetched.json)
try { fetched = JSON.parse(fetched) } catch (e) {}
if (params.ops.target) fetched = get(fetched, params.ops.target);
return fetched;
}