blob: 199c2a6493ef42bbdf304f6674f0cd75bd477552 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
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;
// }
// };
|