From d84192d7fee9718c3a1fe0285b84f47a7cbdd3e2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc=20Bersier?= Date: Sat, 30 Mar 2019 05:08:00 +0100 Subject: [PATCH] thispersondoesnotexist --- .gitignore | 1 + commands/fun/dosentexist.js | 28 ++++++++++++++++++++++++++++ 2 files changed, 29 insertions(+) create mode 100644 commands/fun/dosentexist.js diff --git a/.gitignore b/.gitignore index 494584e4..589f4815 100644 --- a/.gitignore +++ b/.gitignore @@ -14,3 +14,4 @@ videoReady.mp4 package-lock.json img/frame001.png img/spb.png +img/de.png diff --git a/commands/fun/dosentexist.js b/commands/fun/dosentexist.js new file mode 100644 index 00000000..956e9c0b --- /dev/null +++ b/commands/fun/dosentexist.js @@ -0,0 +1,28 @@ +const { Command } = require('discord-akairo'); +const fs = require('fs'); +const fetch = require('node-fetch'); + +class dosentexistCommand extends Command { + constructor() { + super('dosentexist', { + aliases: ['dosentexist', 'thispersondoesnotexist', 'de'], + category: 'fun', + description: { + content: 'Send images from thispersondoesnotexist.com', + usage: '', + examples: [''] + } + }); + } + + async exec(message) { + fetch('https://thispersondoesnotexist.com/image') + .then(res => { + const dest = fs.createWriteStream('./img/de.png'); + res.body.pipe(dest); + dest.on('finish', () => { + return message.channel.send({files: ['./img/de.png']}); + }); + }); } +} +module.exports = dosentexistCommand; \ No newline at end of file