Revert some stuff

This commit is contained in:
Daniel Odendahl Jr
2017-10-22 23:25:43 +00:00
parent 53a99ab85f
commit f75372d2c2
18 changed files with 229 additions and 91 deletions
+1 -5
View File
@@ -1,6 +1,5 @@
const { Command } = require('discord.js-commando');
const snekfetch = require('snekfetch');
const { stripIndents } = require('common-tags');
module.exports = class DanbooruCommand extends Command {
constructor(client) {
@@ -34,10 +33,7 @@ module.exports = class DanbooruCommand extends Command {
limit: 1
});
if (!body.length || !body[0].file_url) return msg.say('Could not find any results.');
return msg.say(stripIndents`
Result for ${query}:
https://danbooru.donmai.us${body[0].file_url}
`);
return msg.say(`https://danbooru.donmai.us${body[0].file_url}`);
} catch (err) {
return msg.say(`Oh no, an error occurred: \`${err.message}\`. Try again later!`);
}
+1 -5
View File
@@ -1,6 +1,5 @@
const { Command } = require('discord.js-commando');
const snekfetch = require('snekfetch');
const { stripIndents } = require('common-tags');
module.exports = class DerpibooruCommand extends Command {
constructor(client) {
@@ -30,10 +29,7 @@ module.exports = class DerpibooruCommand extends Command {
});
if (!search.body) return msg.say('Could not find any results.');
const { body } = await snekfetch.get(`https://derpibooru.org/images/${search.body.id}.json`);
return msg.say(stripIndents`
Result for ${query}:
https:${body.representations.medium}
`);
return msg.say(`https:${body.representations.medium}`);
} catch (err) {
return msg.say(`Oh no, an error occurred: \`${err.message}\`. Try again later!`);
}
+1 -5
View File
@@ -1,7 +1,6 @@
const { Command } = require('discord.js-commando');
const snekfetch = require('snekfetch');
const { xml2js } = require('xml-js');
const { stripIndents } = require('common-tags');
module.exports = class GelbooruCommand extends Command {
constructor(client) {
@@ -34,10 +33,7 @@ module.exports = class GelbooruCommand extends Command {
});
const parsed = xml2js(text, { compact: true }).posts;
if (!parsed.post || !parsed.post.length) return msg.say('Could not find any results.');
return msg.say(stripIndents`
Result for ${query}:
${parsed.post[Math.floor(Math.random() * parsed.post.length)]._attributes.file_url}
`);
return msg.say(`${parsed.post[Math.floor(Math.random() * parsed.post.length)]._attributes.file_url}`);
} catch (err) {
return msg.say(`Oh no, an error occurred: \`${err.message}\`. Try again later!`);
}
+1 -5
View File
@@ -1,6 +1,5 @@
const { Command } = require('discord.js-commando');
const snekfetch = require('snekfetch');
const { stripIndents } = require('common-tags');
module.exports = class KonachanCommand extends Command {
constructor(client) {
@@ -30,10 +29,7 @@ module.exports = class KonachanCommand extends Command {
limit: 1
});
if (!body.length || !body[0].file_url) return msg.say('Could not find any results.');
return msg.say(stripIndents`
Result for ${query}:
https:${body[0].file_url}
`);
return msg.say(`https:${body[0].file_url}`);
} catch (err) {
return msg.say(`Oh no, an error occurred: \`${err.message}\`. Try again later!`);
}
+1 -5
View File
@@ -1,7 +1,6 @@
const { Command } = require('discord.js-commando');
const snekfetch = require('snekfetch');
const { xml2js } = require('xml-js');
const { stripIndents } = require('common-tags');
module.exports = class SafebooruCommand extends Command {
constructor(client) {
@@ -33,10 +32,7 @@ module.exports = class SafebooruCommand extends Command {
});
const parsed = xml2js(text, { compact: true }).posts;
if (!parsed.post || !parsed.post.length) return msg.say('Could not find any results.');
return msg.say(stripIndents`
Result for ${query}:
https:${parsed.post[Math.floor(Math.random() * parsed.post.length)]._attributes.file_url}
`);
return msg.say(`https:${parsed.post[Math.floor(Math.random() * parsed.post.length)]._attributes.file_url}`);
} catch (err) {
return msg.say(`Oh no, an error occurred: \`${err.message}\`. Try again later!`);
}