From fba5f67b4814af6243e1bfa4ccb379b2eb2a76b5 Mon Sep 17 00:00:00 2001 From: Daniel Odendahl Jr Date: Thu, 25 May 2017 23:20:58 +0000 Subject: [PATCH] Switch Things to Linking --- commands/randomimg/cat.js | 6 +----- commands/randomimg/dog.js | 6 +----- commands/search/danbooru.js | 6 +----- commands/search/gelbooru.js | 6 +----- commands/search/giphy.js | 6 +----- commands/search/konachan.js | 6 +----- commands/search/rule34.js | 6 +----- package.json | 2 +- 8 files changed, 8 insertions(+), 36 deletions(-) diff --git a/commands/randomimg/cat.js b/commands/randomimg/cat.js index 8e12f55c..c1622f3f 100644 --- a/commands/randomimg/cat.js +++ b/commands/randomimg/cat.js @@ -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}`); } diff --git a/commands/randomimg/dog.js b/commands/randomimg/dog.js index 72464059..1bed8090 100644 --- a/commands/randomimg/dog.js +++ b/commands/randomimg/dog.js @@ -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}`); } diff --git a/commands/search/danbooru.js b/commands/search/danbooru.js index 14e0a39e..90f7a312 100644 --- a/commands/search/danbooru.js +++ b/commands/search/danbooru.js @@ -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}`); } diff --git a/commands/search/gelbooru.js b/commands/search/gelbooru.js index 42686b95..eb4983df 100644 --- a/commands/search/gelbooru.js +++ b/commands/search/gelbooru.js @@ -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}`); } diff --git a/commands/search/giphy.js b/commands/search/giphy.js index c5b993e9..5396888f 100644 --- a/commands/search/giphy.js +++ b/commands/search/giphy.js @@ -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}`); } diff --git a/commands/search/konachan.js b/commands/search/konachan.js index deaaf6d0..092ac042 100644 --- a/commands/search/konachan.js +++ b/commands/search/konachan.js @@ -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}`); } diff --git a/commands/search/rule34.js b/commands/search/rule34.js index 7c5e0b35..4ba5c77c 100644 --- a/commands/search/rule34.js +++ b/commands/search/rule34.js @@ -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}`); } diff --git a/package.json b/package.json index c141ee0d..ab6116c1 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "xiaobot", - "version": "21.2.0", + "version": "21.2.1", "description": "A Discord Bot", "main": "Shard.js", "scripts": {