Switch Things to Linking

This commit is contained in:
Daniel Odendahl Jr
2017-05-25 23:20:58 +00:00
parent 26a94a9619
commit fba5f67b48
8 changed files with 8 additions and 36 deletions
+1 -5
View File
@@ -13,14 +13,10 @@ module.exports = class CatCommand extends Command {
}
async run(msg) {
if (msg.channel.type !== 'dm')
if (!msg.channel.permissionsFor(this.client.user).has('ATTACH_FILES'))
return msg.say('This Command requires the `Attach Files` Permission.');
try {
const { body } = await snekfetch
.get('http://random.cat/meow');
return msg.say({ files: [body.file] })
.catch(err => msg.say(`${err.name}: ${err.message}`));
return msg.say(body.file);
} catch (err) {
return msg.say(`${err.name}: ${err.message}`);
}
+1 -5
View File
@@ -12,14 +12,10 @@ module.exports = class DogCommand extends Command {
}
async run(msg) {
if (msg.channel.type !== 'dm')
if (!msg.channel.permissionsFor(this.client.user).has('ATTACH_FILES'))
return msg.say('This Command requires the `Attach Files` Permission.');
try {
const { body } = await snekfetch
.get('https://random.dog/woof.json');
return msg.say({ files: [body.url] })
.catch(err => msg.say(`${err.name}: ${err.message}`));
return msg.say(body.url);
} catch (err) {
return msg.say(`${err.name}: ${err.message}`);
}
+1 -5
View File
@@ -8,7 +8,6 @@ module.exports = class DanbooruCommand extends Command {
group: 'search',
memberName: 'danbooru',
description: 'Sends an image from Danbooru, with optional query.',
guildOnly: true,
args: [
{
key: 'query',
@@ -22,8 +21,6 @@ module.exports = class DanbooruCommand extends Command {
async run(msg, args) {
if (!msg.channel.nsfw) return msg.say('This Command can only be used in NSFW Channels.');
if (!msg.channel.permissionsFor(this.client.user).has('ATTACH_FILES'))
return msg.say('This Command requires the `Attach Files` Permission.');
const { query } = args;
try {
const { body } = await snekfetch
@@ -33,8 +30,7 @@ module.exports = class DanbooruCommand extends Command {
limit: 1
});
if (!body.length) throw new Error('No Results.');
return msg.say(query ? `Result for ${query}:` : 'Random Image:', { files: [`https://danbooru.donmai.us${body[0].file_url}`] })
.catch(err => msg.say(`${err.name}: ${err.message}`));
return msg.say(`${query ? `Result for ${query}:` : 'Random Image:'} https://danbooru.donmai.us${body[0].file_url}`);
} catch (err) {
return msg.say(`${err.name}: ${err.message}`);
}
+1 -5
View File
@@ -10,7 +10,6 @@ module.exports = class GelbooruCommand extends Command {
group: 'search',
memberName: 'gelbooru',
description: 'Sends an image from Gelbooru, with query.',
guildOnly: true,
args: [
{
key: 'query',
@@ -23,8 +22,6 @@ module.exports = class GelbooruCommand extends Command {
async run(msg, args) {
if (!msg.channel.nsfw) return msg.say('This Command can only be used in NSFW Channels.');
if (!msg.channel.permissionsFor(this.client.user).has('ATTACH_FILES'))
return msg.say('This Command requires the `Attach Files` Permission.');
const { query } = args;
try {
const { text } = await snekfetch
@@ -38,8 +35,7 @@ module.exports = class GelbooruCommand extends Command {
});
const { posts } = await xml(text);
if (posts.$.count === '0') throw new Error('No Results.');
return msg.say(`Result for ${query}:`, { files: [`https:${posts.post[0].$.file_url}`] })
.catch(err => msg.say(`${err.name}: ${err.message}`));
return msg.say(`Result for ${query}: https:${posts.post[0].$.file_url}`);
} catch (err) {
return msg.say(`${err.name}: ${err.message}`);
}
+1 -5
View File
@@ -20,9 +20,6 @@ module.exports = class GiphyCommand extends Command {
}
async run(msg, args) {
if (msg.channel.type !== 'dm')
if (!msg.channel.permissionsFor(this.client.user).has('ATTACH_FILES'))
return msg.say('This Command requires the `Attach Files` Permission.');
const { query } = args;
try {
const { body } = await snekfetch
@@ -34,8 +31,7 @@ module.exports = class GiphyCommand extends Command {
});
if (!body.data.length) throw new Error('No Results.');
const random = Math.floor(Math.random() * body.data.length);
return msg.say({ files: [body.data[random].images.original.url] })
.catch(err => msg.say(`${err.name}: ${err.message}`));
return msg.say(body.data[random].images.original.url);
} catch (err) {
return msg.say(`${err.name}: ${err.message}`);
}
+1 -5
View File
@@ -8,7 +8,6 @@ module.exports = class KonachanCommand extends Command {
group: 'search',
memberName: 'konachan',
description: 'Sends an image from Konachan, with optional query.',
guildOnly: true,
args: [
{
key: 'query',
@@ -22,8 +21,6 @@ module.exports = class KonachanCommand extends Command {
async run(msg, args) {
if (!msg.channel.nsfw) return msg.say('This Command can only be used in NSFW Channels.');
if (!msg.channel.permissionsFor(this.client.user).has('ATTACH_FILES'))
return msg.say('This Command requires the `Attach Files` Permission.');
const { query } = args;
try {
const { body } = await snekfetch
@@ -33,8 +30,7 @@ module.exports = class KonachanCommand extends Command {
limit: 1
});
if (!body.length) throw new Error('No Results.');
return msg.say(query ? `Result for ${query}:` : 'Random Image:', { files: [`https:${body[0].file_url}`] })
.catch(err => msg.say(`${err.name}: ${err.message}`));
return msg.say(`${query ? `Result for ${query}:` : 'Random Image:'} https:${body[0].file_url}`);
} catch (err) {
return msg.say(`${err.name}: ${err.message}`);
}
+1 -5
View File
@@ -10,7 +10,6 @@ module.exports = class Rule34Command extends Command {
group: 'search',
memberName: 'rule34',
description: 'Sends an image from Rule34, with query.',
guildOnly: true,
args: [
{
key: 'query',
@@ -23,8 +22,6 @@ module.exports = class Rule34Command extends Command {
async run(msg, args) {
if (!msg.channel.nsfw) return msg.say('This Command can only be used in NSFW Channels.');
if (!msg.channel.permissionsFor(this.client.user).has('ATTACH_FILES'))
return msg.say('This Command requires the `Attach Files` Permission.');
const { query } = args;
try {
const { text } = await snekfetch
@@ -38,8 +35,7 @@ module.exports = class Rule34Command extends Command {
});
const { posts } = await xml(text);
if (posts.$.count === '0') throw new Error('No Results.');
return msg.say(`Result for ${query}:`, { files: [`https:${posts.post[0].$.file_url}`] })
.catch(err => msg.say(`${err.name}: ${err.message}`));
return msg.say(`Result for ${query}: https:${posts.post[0].$.file_url}`);
} catch (err) {
return msg.say(`${err.name}: ${err.message}`);
}
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "xiaobot",
"version": "21.2.0",
"version": "21.2.1",
"description": "A Discord Bot",
"main": "Shard.js",
"scripts": {