From 30f2e6293defe4fa4090a009c9a9032c695630e3 Mon Sep 17 00:00:00 2001 From: 8cy <50817549+8cy@users.noreply.github.com> Date: Wed, 29 Apr 2020 17:37:31 -0700 Subject: The Memeification, v9.2.0 - fix goodbye - add more models - formatting - uncomment error loggers --- src/models/commands/ImgurAlbum.ts | 43 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 src/models/commands/ImgurAlbum.ts (limited to 'src/models/commands/ImgurAlbum.ts') diff --git a/src/models/commands/ImgurAlbum.ts b/src/models/commands/ImgurAlbum.ts new file mode 100644 index 0000000..199c2a6 --- /dev/null +++ b/src/models/commands/ImgurAlbum.ts @@ -0,0 +1,43 @@ +// import request from 'node-superfetch'; +// import Command from '../Command.js' +// const { IMGUR_KEY } = process.env; + +// module.exports = class ImgurAlbumCommand extends Command { +// constructor(client, info) { +// super(client, info); + +// this.albumID = info.albumID; +// this.cache = null; +// this.credit.push({ +// name: 'Imgur', +// url: 'https://imgur.com/', +// reason: 'API', +// reasonURL: 'https://apidocs.imgur.com/' +// }); +// } + +// async run(msg, { user }) { +// try { +// const image = await this.random(); +// if (!image) return msg.reply('This album has no images...'); +// return msg.say(this.generateText(msg, user), { files: [image] }); +// } catch (err) { +// return msg.reply(`Oh no, an error occurred: \`${err.message}\`. Try again later!`); +// } +// } + +// generateText() { +// throw new Error('The generateText method is required.'); +// } + +// async random() { +// if (this.cache) return this.cache[Math.floor(Math.random() * this.cache.length)]; +// const { body } = await request +// .get(`https://api.imgur.com/3/album/${this.albumID}`) +// .set({ Authorization: `Client-ID ${IMGUR_KEY}` }); +// if (!body.data.images.length) return null; +// this.cache = body.data.images.map(image => image.link); +// setTimeout(() => { this.cache = null; }, 3.6e+6); +// return body.data.images[Math.floor(Math.random() * body.data.images.length)].link; +// } +// }; \ No newline at end of file -- cgit v1.2.3