diff --git a/.env.example b/.env.example index 02d9c8c3..47d86611 100644 --- a/.env.example +++ b/.env.example @@ -38,7 +38,6 @@ DEVIANTART_SECRET= GIPHY_KEY= GITHUB_ACCESS_TOKEN= GOV_KEY= -IMGUR_KEY= OPENWEATHERMAP_KEY= OSU_KEY= SPOTIFY_KEY= @@ -47,6 +46,3 @@ USPS_USERID= WEBSTER_KEY= XIAO_GITHUB_REPO_NAME= XIAO_GITHUB_REPO_USERNAME= - -# Imgur album IDs -XIAO_ALBUM_ID= diff --git a/assets/images/xiao/2Kiz3Jq.jpg b/assets/images/xiao/2Kiz3Jq.jpg new file mode 100644 index 00000000..65c952ba Binary files /dev/null and b/assets/images/xiao/2Kiz3Jq.jpg differ diff --git a/assets/images/xiao/3.jpg b/assets/images/xiao/3.jpg new file mode 100644 index 00000000..3f4db937 Binary files /dev/null and b/assets/images/xiao/3.jpg differ diff --git a/assets/images/xiao/8WdAvPk.jpg b/assets/images/xiao/8WdAvPk.jpg new file mode 100644 index 00000000..7263beef Binary files /dev/null and b/assets/images/xiao/8WdAvPk.jpg differ diff --git a/assets/images/xiao/AXHAdsu.jpg b/assets/images/xiao/AXHAdsu.jpg new file mode 100644 index 00000000..eddabfc9 Binary files /dev/null and b/assets/images/xiao/AXHAdsu.jpg differ diff --git a/assets/images/xiao/Airful.jpg b/assets/images/xiao/Airful.jpg new file mode 100755 index 00000000..b8011082 Binary files /dev/null and b/assets/images/xiao/Airful.jpg differ diff --git a/assets/images/xiao/CGUjwHS.jpg b/assets/images/xiao/CGUjwHS.jpg new file mode 100644 index 00000000..3fdb19f7 Binary files /dev/null and b/assets/images/xiao/CGUjwHS.jpg differ diff --git a/assets/images/xiao/DC4dIf1.jpg b/assets/images/xiao/DC4dIf1.jpg new file mode 100644 index 00000000..973807fe Binary files /dev/null and b/assets/images/xiao/DC4dIf1.jpg differ diff --git a/assets/images/xiao/DcTADmq.jpg b/assets/images/xiao/DcTADmq.jpg new file mode 100644 index 00000000..a30ed893 Binary files /dev/null and b/assets/images/xiao/DcTADmq.jpg differ diff --git a/assets/images/xiao/DyW1DJ0.jpg b/assets/images/xiao/DyW1DJ0.jpg new file mode 100644 index 00000000..4e2b9797 Binary files /dev/null and b/assets/images/xiao/DyW1DJ0.jpg differ diff --git a/assets/images/xiao/GlZZSsK.jpg b/assets/images/xiao/GlZZSsK.jpg new file mode 100644 index 00000000..a1d9c0f3 Binary files /dev/null and b/assets/images/xiao/GlZZSsK.jpg differ diff --git a/assets/images/xiao/HLJXkQk.jpg b/assets/images/xiao/HLJXkQk.jpg new file mode 100644 index 00000000..1a41e557 Binary files /dev/null and b/assets/images/xiao/HLJXkQk.jpg differ diff --git a/assets/images/xiao/IQIMmZV.jpg b/assets/images/xiao/IQIMmZV.jpg new file mode 100644 index 00000000..89c2f096 Binary files /dev/null and b/assets/images/xiao/IQIMmZV.jpg differ diff --git a/assets/images/xiao/Ih2Fbbh.png b/assets/images/xiao/Ih2Fbbh.png new file mode 100644 index 00000000..8727bc38 Binary files /dev/null and b/assets/images/xiao/Ih2Fbbh.png differ diff --git a/assets/images/xiao/JK66QjX.jpg b/assets/images/xiao/JK66QjX.jpg new file mode 100644 index 00000000..b0a1b617 Binary files /dev/null and b/assets/images/xiao/JK66QjX.jpg differ diff --git a/assets/images/xiao/Kurianamio.jpg b/assets/images/xiao/Kurianamio.jpg new file mode 100755 index 00000000..4292d685 Binary files /dev/null and b/assets/images/xiao/Kurianamio.jpg differ diff --git a/assets/images/xiao/MNL5ieg.png b/assets/images/xiao/MNL5ieg.png new file mode 100644 index 00000000..f9c9e51f Binary files /dev/null and b/assets/images/xiao/MNL5ieg.png differ diff --git a/assets/images/xiao/RFSSvbE.jpg b/assets/images/xiao/RFSSvbE.jpg new file mode 100644 index 00000000..85c95c12 Binary files /dev/null and b/assets/images/xiao/RFSSvbE.jpg differ diff --git a/assets/images/xiao/SzimCMB.jpg b/assets/images/xiao/SzimCMB.jpg new file mode 100644 index 00000000..2e192838 Binary files /dev/null and b/assets/images/xiao/SzimCMB.jpg differ diff --git a/assets/images/xiao/YqZmeyA.jpg b/assets/images/xiao/YqZmeyA.jpg new file mode 100644 index 00000000..a31cd93f Binary files /dev/null and b/assets/images/xiao/YqZmeyA.jpg differ diff --git a/assets/images/xiao/a4TsRS1.jpg b/assets/images/xiao/a4TsRS1.jpg new file mode 100644 index 00000000..feac6b66 Binary files /dev/null and b/assets/images/xiao/a4TsRS1.jpg differ diff --git a/assets/images/xiao/abNJ8FT.jpg b/assets/images/xiao/abNJ8FT.jpg new file mode 100644 index 00000000..572365eb Binary files /dev/null and b/assets/images/xiao/abNJ8FT.jpg differ diff --git a/assets/images/xiao/fFsF6m7.jpg b/assets/images/xiao/fFsF6m7.jpg new file mode 100644 index 00000000..eba78d8e Binary files /dev/null and b/assets/images/xiao/fFsF6m7.jpg differ diff --git a/assets/images/xiao/gKDJiyO.jpg b/assets/images/xiao/gKDJiyO.jpg new file mode 100644 index 00000000..7f186f45 Binary files /dev/null and b/assets/images/xiao/gKDJiyO.jpg differ diff --git a/assets/images/xiao/guJ29wp.png b/assets/images/xiao/guJ29wp.png new file mode 100644 index 00000000..b028c2d3 Binary files /dev/null and b/assets/images/xiao/guJ29wp.png differ diff --git a/assets/images/xiao/hstWdiN.jpg b/assets/images/xiao/hstWdiN.jpg new file mode 100644 index 00000000..60696ef6 Binary files /dev/null and b/assets/images/xiao/hstWdiN.jpg differ diff --git a/assets/images/xiao/iB6durw.png b/assets/images/xiao/iB6durw.png new file mode 100644 index 00000000..c1262455 Binary files /dev/null and b/assets/images/xiao/iB6durw.png differ diff --git a/assets/images/xiao/iPidJ1s.jpg b/assets/images/xiao/iPidJ1s.jpg new file mode 100644 index 00000000..8b2d87a5 Binary files /dev/null and b/assets/images/xiao/iPidJ1s.jpg differ diff --git a/assets/images/xiao/kG6Qp9U.jpg b/assets/images/xiao/kG6Qp9U.jpg new file mode 100644 index 00000000..f7ff95ab Binary files /dev/null and b/assets/images/xiao/kG6Qp9U.jpg differ diff --git a/assets/images/xiao/lV39HXw.jpg b/assets/images/xiao/lV39HXw.jpg new file mode 100644 index 00000000..ca054758 Binary files /dev/null and b/assets/images/xiao/lV39HXw.jpg differ diff --git a/assets/images/xiao/oaC7wKG.jpg b/assets/images/xiao/oaC7wKG.jpg new file mode 100644 index 00000000..5f05d2dd Binary files /dev/null and b/assets/images/xiao/oaC7wKG.jpg differ diff --git a/assets/images/xiao/otIT53z.jpg b/assets/images/xiao/otIT53z.jpg new file mode 100644 index 00000000..ab3c00e4 Binary files /dev/null and b/assets/images/xiao/otIT53z.jpg differ diff --git a/assets/images/xiao/piu8UXR.jpg b/assets/images/xiao/piu8UXR.jpg new file mode 100644 index 00000000..89d269ef Binary files /dev/null and b/assets/images/xiao/piu8UXR.jpg differ diff --git a/assets/images/xiao/qZYuM84.jpg b/assets/images/xiao/qZYuM84.jpg new file mode 100644 index 00000000..28d232e8 Binary files /dev/null and b/assets/images/xiao/qZYuM84.jpg differ diff --git a/assets/images/xiao/shiroguri.jpg b/assets/images/xiao/shiroguri.jpg new file mode 100755 index 00000000..e567d746 Binary files /dev/null and b/assets/images/xiao/shiroguri.jpg differ diff --git a/assets/images/xiao/w2rmDfM.jpg b/assets/images/xiao/w2rmDfM.jpg new file mode 100644 index 00000000..0dae3bba Binary files /dev/null and b/assets/images/xiao/w2rmDfM.jpg differ diff --git a/assets/images/xiao/wneFRY7.jpg b/assets/images/xiao/wneFRY7.jpg new file mode 100644 index 00000000..60330af2 Binary files /dev/null and b/assets/images/xiao/wneFRY7.jpg differ diff --git a/assets/images/xiao/x8cA0Mw.jpg b/assets/images/xiao/x8cA0Mw.jpg new file mode 100644 index 00000000..3302cad5 Binary files /dev/null and b/assets/images/xiao/x8cA0Mw.jpg differ diff --git a/assets/images/xiao/yvBlxxP.png b/assets/images/xiao/yvBlxxP.png new file mode 100644 index 00000000..58ddfd02 Binary files /dev/null and b/assets/images/xiao/yvBlxxP.png differ diff --git a/assets/images/xiao/zqXl6TB.gif b/assets/images/xiao/zqXl6TB.gif new file mode 100644 index 00000000..5a7f1123 Binary files /dev/null and b/assets/images/xiao/zqXl6TB.gif differ diff --git a/commands/random-img/xiao.js b/commands/random-img/xiao.js index f2a6a76c..2be042e7 100644 --- a/commands/random-img/xiao.js +++ b/commands/random-img/xiao.js @@ -1,7 +1,9 @@ -const ImgurAlbumCommand = require('../../structures/commands/ImgurAlbum'); -const { XIAO_ALBUM_ID } = process.env; +const Command = require('../../framework/Command'); +const fs = require('fs'); +const path = require('path'); +const images = fs.readdirSync(path.join(__dirname, '..', '..', 'assets', 'images', 'xiao')); -module.exports = class XiaoCommand extends ImgurAlbumCommand { +module.exports = class XiaoCommand extends Command { constructor(client) { super(client, { name: 'xiao', @@ -22,7 +24,8 @@ module.exports = class XiaoCommand extends ImgurAlbumCommand { }); } - generateText() { - return 'It\'s me, yes?'; + run(msg) { + const image = images[Math.floor(Math.random() * images.length)]; + return msg.say({ files: [path.join(__dirname, '..', '..', 'assets', 'images', 'xiao', images[image])] }); } }; diff --git a/commands/search/imgur.js b/commands/search/imgur.js deleted file mode 100644 index 630f3654..00000000 --- a/commands/search/imgur.js +++ /dev/null @@ -1,43 +0,0 @@ -const Command = require('../../framework/Command'); -const request = require('node-superfetch'); -const { IMGUR_KEY } = process.env; - -module.exports = class ImgurCommand extends Command { - constructor(client) { - super(client, { - name: 'imgur', - group: 'search', - memberName: 'imgur', - description: 'Searches Imgur for your query.', - credit: [ - { - name: 'Imgur', - url: 'https://imgur.com/', - reason: 'API', - reasonURL: 'https://apidocs.imgur.com/' - } - ], - args: [ - { - key: 'query', - prompt: 'What image would you like to search for?', - type: 'string' - } - ] - }); - } - - async run(msg, { query }) { - try { - const { body } = await request - .get('https://api.imgur.com/3/gallery/search') - .query({ q: query }) - .set({ Authorization: `Client-ID ${IMGUR_KEY}` }); - const images = body.data.filter(image => image.images && (msg.channel.nsfw ? true : !image.nsfw)); - if (!images.length) return msg.say('Could not find any results.'); - return msg.say(images[Math.floor(Math.random() * images.length)].images[0].link); - } catch (err) { - return msg.reply(`Oh no, an error occurred: \`${err.message}\`. Try again later!`); - } - } -}; diff --git a/structures/commands/ImgurAlbum.js b/structures/commands/ImgurAlbum.js deleted file mode 100644 index ab5df9fe..00000000 --- a/structures/commands/ImgurAlbum.js +++ /dev/null @@ -1,56 +0,0 @@ -const request = require('node-superfetch'); -const Command = require('../../framework/Command'); -const path = require('path'); -const { reactIfAble } = require('../../util/Util'); -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/' - }); - this.audio = info.audio || null; - } - - async run(msg, { user }) { - if (this.audio) { - const connection = msg.guild ? this.client.voice.connections.get(msg.guild.id) : null; - if (msg.guild && connection && !this.client.dispatchers.has(msg.guild.id)) { - const dispatcher = connection.play(path.join(__dirname, '..', '..', 'assets', 'sounds', this.audio)); - this.client.dispatchers.set(msg.guild.id, dispatcher); - dispatcher.once('finish', () => this.client.dispatchers.delete(msg.guild.id)); - dispatcher.once('error', () => this.client.dispatchers.delete(msg.guild.id)); - await reactIfAble(msg, this.client.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; - } -};