forked from Supositware/Haha-Yes
Fetch video from petittube.com
Signed-off-by: loicbersier <loic.bersier1@gmail.com>
This commit is contained in:
parent
c5558e0b3b
commit
9a217cc139
1 changed files with 30 additions and 0 deletions
30
commands/fun/petittube.js
Normal file
30
commands/fun/petittube.js
Normal file
|
@ -0,0 +1,30 @@
|
|||
const { Command } = require('discord-akairo');
|
||||
const fetch = require('node-fetch');
|
||||
const cheerio = require('cheerio');
|
||||
|
||||
class PetitTubeCommand extends Command {
|
||||
constructor() {
|
||||
super('petittube', {
|
||||
aliases: ['petittube', 'pt'],
|
||||
category: 'fun',
|
||||
clientPermissions: ['SEND_MESSAGES', 'ATTACH_FILES'],
|
||||
description: {
|
||||
content: 'Fetch a video from https://petittube.com/',
|
||||
usage: '',
|
||||
examples: ['']
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
async exec(message) {
|
||||
const response = await fetch('https://petittube.com/');
|
||||
const body = await response.text();
|
||||
|
||||
const $ = cheerio.load(body);
|
||||
|
||||
const url = $('iframe')[0].attribs.src;
|
||||
|
||||
this.client.commandHandler.runCommand(message, this.client.commandHandler.findCommand('download'), { link: new URL(url), proxy: 1, spoiler: true, caption: 'Video might be NSFW as always, be careful!'});
|
||||
}
|
||||
}
|
||||
module.exports = PetitTubeCommand;
|
Loading…
Reference in a new issue