mirror of
https://github.com/ION606/selmerBot.git
synced 2026-05-14 21:26:54 +00:00
Transitioned all Misc, audio, Selmer Specific, admin, anime/manga, and inventory commands to Slash Command format. The RSS and reactionrole commands are still broken and all game commands are still in message format due to compications
This commit is contained in:
+30
-24
@@ -1,35 +1,41 @@
|
||||
const hastebin = require("hastebin-gen");
|
||||
const { addComplaintButton } = require('../dev only/submitcomplaint');
|
||||
const { Constants } = require('discord.js');
|
||||
|
||||
module.exports ={
|
||||
name: "scrape",
|
||||
description: ".....",
|
||||
async execute(message, args, Discord, Client, bot) {
|
||||
description: "Scrapes a website, then puts the result into a hastebin",
|
||||
async execute(interaction, Discord, Client, bot) {
|
||||
const axios = require('axios');
|
||||
const cheerio = require('cheerio');
|
||||
const url = args[0];
|
||||
axios(url)
|
||||
.then(async response => {
|
||||
const html = response.data;
|
||||
const $ = cheerio.load(html);
|
||||
//lyrics = $('.para_row').text();
|
||||
// const cheerio = require('cheerio');
|
||||
const url = interaction.options.data[0].value;
|
||||
axios(url)
|
||||
.then(async response => {
|
||||
const html = response.data;
|
||||
// const $ = cheerio.load(html);
|
||||
//lyrics = $('.para_row').text();
|
||||
|
||||
const haste = await hastebin(html, { extension: "txt" });
|
||||
message.channel.send(haste);
|
||||
// console.log(lyrics);
|
||||
})
|
||||
.catch(function(err) {
|
||||
if (err.message.indexOf('The "url" argument must be of type string') != -1) {
|
||||
message.reply("The URL should be a string!");
|
||||
} else if (err.code == 'ERR_BAD_REQUEST') {
|
||||
message.reply("404 link not valid!")
|
||||
} else {
|
||||
message.reply("Oops! There's been an error, click the ✅ to report this!");
|
||||
addComplaintButton(bot, message);
|
||||
console.log(err);
|
||||
}
|
||||
const haste = await hastebin(html, { extension: "txt" });
|
||||
interaction.reply(haste);
|
||||
// console.log(lyrics);
|
||||
})
|
||||
.catch(function(err) {
|
||||
if (err.message.indexOf('The "url" argument must be of type string') != -1) {
|
||||
interaction.reply("The URL should be a string!");
|
||||
} else if (err.code == 'ERR_BAD_REQUEST') {
|
||||
interaction.reply("404 link not valid!")
|
||||
} else {
|
||||
const m = interaction.reply("Oops! There's been an error, click the ✅ to report this!");
|
||||
|
||||
m.then((msg) => {
|
||||
addComplaintButton(bot, msg);
|
||||
});
|
||||
}
|
||||
|
||||
console.log(err);
|
||||
}
|
||||
});
|
||||
},
|
||||
options: [{name: 'url', description: 'The website URL', type: Constants.ApplicationCommandOptionTypes.STRING, required: true }]
|
||||
}
|
||||
|
||||
//TEST: https://www.karaoketexty.cz/texty-pisni/zoegirl/plain-170199
|
||||
Reference in New Issue
Block a user