UNPKG

mxsicxyz

Version:

An api wrapper for mxsicxyz for Discord JavaScript Bots

34 lines (29 loc) 888 B
tinees = require('./end'); fetch = require('node-fetch'); class tinee { constructor(options = {}) { if(!options.KEY) throw new Error("No key found for Lewds.GA"); this.KEY = options.KEY; }; /** * @param {String} img endpoint to search * @returns {String} url of image */ async nsfw(img) { return fetch(`${tinees.base}${img}?key=${this.KEY}`) .then(res => res.json()) .then(json => { if(json.url == undefined) throw Error(`[LEWDS]: ${img} is not a valid endpoint!`) return json.url }) } async sfw(img) { return fetch(`${tinees.baseSafe}${img}?key=${this.KEY}`) .then(res => res.json()) .then(json => { if(json.url == undefined) throw Error(`[LEWDS]: ${img} is not a valid endpoint!`) return json.url }) } } module.exports = tinee