New NSFW Command

This commit is contained in:
Dragon Fire
2020-06-08 12:01:18 -04:00
parent 2b34211ad2
commit b7794c5e32
3 changed files with 54 additions and 2 deletions
+4 -1
View File
@@ -226,7 +226,7 @@ in the appropriate channel's topic to use it.
## Commands
Total: 462
Total: 463
### Utility:
@@ -442,6 +442,7 @@ Total: 462
* **paladins:** Responds with information on a Paladins player.
* **periodic-table:** Finds an element on the periodic table.
* **pokedex:** Searches the Pokédex for a Pokémon.
* **pornhub:** Searches Pornhub for your query. (NSFW)
* **recipe:** Searches for recipes based on your query.
* **reddit:** Responds with information on a Reddit user.
* **right-stuf:** Searches Right Stuf Anime for your query.
@@ -1274,6 +1275,8 @@ here.
* soundboard (Pikachu Sound)
* whos-that-pokemon (Images, Original Game)
* wynaut (Image, Original Anime)
- [Pornhub](https://www.pornhub.com/)
* pornhub (Video Data)
- [Pottermore](https://my.pottermore.com/sorting)
* sorting-hat (Original Quiz)
- [PSYCHO-PASS](http://psycho-pass.com/)
+49
View File
@@ -0,0 +1,49 @@
const Command = require('../../structures/Command');
const request = require('node-superfetch');
const cheerio = require('cheerio');
module.exports = class PornhubCommand extends Command {
constructor(client) {
super(client, {
name: 'pornhub',
group: 'search',
memberName: 'pornhub',
description: 'Searches Pornhub for your query.',
nsfw: true,
credit: [
{
name: 'Pornhub',
url: 'https://www.pornhub.com/',
reason: 'Video Data'
}
],
args: [
{
key: 'query',
prompt: 'What video would you like to search for?',
type: 'string'
}
]
});
}
async run(msg, { query }) {
try {
const url = await this.search(query);
if (!url) return msg.say('Could not find any results.');
return msg.say(url);
} catch (err) {
return msg.reply(`Oh no, an error occurred: \`${err.message}\`. Try again later!`);
}
}
async search(query) {
const { text } = await request
.get(`https://www.pornhub.com/video/search`)
.query({ search: query });
if (text.includes('<div class="noResultsWrapper">')) return null;
const $ = cheerio.load(text);
const video = $('li[class="pcVideoListItem js-pop videoblock videoBox"]').eq(5);
return `https://www.pornhub.com/view_video.php?viewkey=${video.attr('_vkey')}`;
}
};
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "xiao",
"version": "116.7.0",
"version": "116.8.0",
"description": "Your personal server companion.",
"main": "Xiao.js",
"scripts": {