You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
42 lines
1010 B
JavaScript
42 lines
1010 B
JavaScript
6 years ago
|
const { Command } = require('discord-akairo');
|
||
|
const fs = require('fs');
|
||
|
const fetch = require('node-fetch');
|
||
|
|
||
|
class spbCommand extends Command {
|
||
|
constructor() {
|
||
|
super('spb', {
|
||
6 years ago
|
aliases: ['spb'],
|
||
![]()
6 years ago
|
category: 'fun',
|
||
6 years ago
|
args: [
|
||
|
{
|
||
|
id: 'link',
|
||
|
type: 'string'
|
||
|
}
|
||
|
],
|
||
|
description: {
|
||
|
content: 'Generate a meme from template you send with spb5k (ONLY WORK WITH TEMPLATES)',
|
||
|
usage: '',
|
||
|
examples: ['']
|
||
|
}
|
||
|
});
|
||
|
}
|
||
|
|
||
|
async exec(message, args) {
|
||
6 years ago
|
if (!args.link || !args.link.includes('shitpostbot.com/template/')) {
|
||
6 years ago
|
return message.channel.send('Need a Shitpostbot 5000 template link!\nYou can find them here! <https://www.shitpostbot.com/gallery/templates>');
|
||
6 years ago
|
}
|
||
|
|
||
|
let link = args.link.replace('template', 'preview');
|
||
|
|
||
|
fetch(link)
|
||
|
.then(res => {
|
||
6 years ago
|
const dest = fs.createWriteStream('./img/spb.png');
|
||
6 years ago
|
res.body.pipe(dest);
|
||
6 years ago
|
dest.on('finish', () => {
|
||
6 years ago
|
return message.channel.send({files: ['./img/spb.png']});
|
||
6 years ago
|
});
|
||
6 years ago
|
});
|
||
|
}
|
||
|
}
|
||
|
|
||
|
module.exports = spbCommand;
|