Haha-Yes/commands/fun/doesntexist.js

28 lines
735 B
JavaScript
Raw Normal View History

2019-03-30 05:08:00 +01:00
const { Command } = require('discord-akairo');
const fs = require('fs');
const fetch = require('node-fetch');
class dosentexistCommand extends Command {
constructor() {
super('dosentexist', {
2019-03-30 15:19:17 +01:00
aliases: ['doesntexist', 'thispersondoesnotexist', 'de'],
2019-03-30 05:08:00 +01:00
category: 'fun',
description: {
content: 'Send images from thispersondoesnotexist.com',
usage: '',
examples: ['']
}
});
}
async exec(message) {
fetch('https://thispersondoesnotexist.com/image')
.then(res => {
2019-11-04 14:41:45 +01:00
const dest = fs.createWriteStream('./asset/img/de.png');
2019-03-30 05:08:00 +01:00
res.body.pipe(dest);
dest.on('finish', () => {
2019-11-04 14:41:45 +01:00
return message.channel.send({files: ['./asset/img/de.png']});
2019-03-30 05:08:00 +01:00
});
}); }
}
module.exports = dosentexistCommand;