UNPKG

692 BJavaScriptView Raw
1 const action = require("./assets.json");
2 const endpoints = require('./endpoints.json');
3
4 function getImage (obj) {
5 return action[obj][Math.floor(Math.random() * action[obj].length)]
6 }
7
8 class AFLB {
9 constructor() {
10 let self = this;
11 self.sfw = {};
12 self.nsfw = {};
13 Object.keys(endpoints.sfw).forEach(async (endpoint) => {
14 self.sfw[endpoint] = function () {
15 return getImage(endpoint);
16 };
17 });
18 Object.keys(endpoints.nsfw).forEach(async (endpoint) => {
19 self.nsfw[endpoint] = function () {
20 return getImage(endpoint);
21 };
22 });
23 }
24 }
25
26 module.exports = AFLB;
\No newline at end of file