Baphomet is the dedicated bot for nulloctet matrix
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
/** * Giphy module */
let { AbstractModule } = require('./abstract'); let axios = require('axios'); let { logger } = require('../logging');
class GiphyModule extends AbstractModule { constructor() { super( "Giphy", "Insert Giphy Links/Media", "giphy" ); this.helpAndUsage = `Usage: !giphy itsworking
...`;
this.needConfig = true; this.defaultCommand = 'search'; }
getConfigSensitiveFields() { return ["apiKey"]; }
getGiphySearch(term) { let url = this._config.endpoint + '/gifs/search?api_key=' + this._config.apiKey + '&q=' + term + '&limit=1'; logger.debug("Requesting: %s", url.replace(this._config.apiKey, '******')); return axios.get(url); }
/** * Return the top item for the search terms. * * @param {...any} args */ cmd_search(...args) { return this.getGiphySearch(args[0]) .then((response) => { // logger.debug("Giphy response: %o", response.data.data[0].url);
return response.data.data[0].embed_url; }) } }
exports.module = new GiphyModule();
|