diff --git a/commands/search/define.js b/commands/search/define.js index 8642a740..8cd59de3 100644 --- a/commands/search/define.js +++ b/commands/search/define.js @@ -25,9 +25,9 @@ module.exports = class DefineCommand extends commando.Command { if(!message.channel.permissionsFor(this.client.user).hasPermission(['SEND_MESSAGES', 'READ_MESSAGES', 'EMBED_LINKS'])) return; } console.log("[Command] " + message.content); - let defineThis = message.content.toLowerCase().split(" ").slice(1).join("%20"); + let defineThis = encodeURI(message.content.split(" ").slice(1).join(" ")); request - .get('http://api.wordnik.com:80/v4/word.json/' + defineThis + '/definitions') + .get('http://api.wordnik.com:80/v4/word.json/' + encodeURI(defineThis) + '/definitions') .query({ limit: 1, includeRelated: false, useCanonical: false, includeTags: false, api_key: config.wordnikkey }) .then(function (response) { const embed = new Discord.RichEmbed() diff --git a/commands/search/google.js b/commands/search/google.js index 7d0b6fe9..4a31ea3e 100644 --- a/commands/search/google.js +++ b/commands/search/google.js @@ -22,8 +22,9 @@ module.exports = class DefineCommand extends commando.Command { if(!message.channel.permissionsFor(this.client.user).hasPermission(['SEND_MESSAGES', 'READ_MESSAGES'])) return; } console.log("[Command] " + message.content); + let thingtoSearch = encodeURI(message.content.split(" ").slice(1).join(" ")); message.channel.send('Searching...'); - const SEARCH_URL = `https://www.google.com/search?q=${encodeURI(message.content)}`; + const SEARCH_URL = 'https://www.google.com/search?q=' + thingtoSearch; request .get(SEARCH_URL) .then(function (response) { diff --git a/commands/search/neopet.js b/commands/search/neopet.js index 3dc3eaf5..8f772c16 100644 --- a/commands/search/neopet.js +++ b/commands/search/neopet.js @@ -16,7 +16,7 @@ module.exports = class NeopetCommand extends commando.Command { if(!message.channel.permissionsFor(this.client.user).hasPermission(['SEND_MESSAGES', 'READ_MESSAGES', 'ATTACH_FILES'])) return; } console.log("[Command] " + message.content); - let petID = message.content.toLowerCase().split(" ").slice(1).join(" "); + let petID = encodeURI(message.content.split(" ").slice(1).join(" ")); if(petID === "getid") { message.channel.send("To get your pet's ID, simply go to http://www.sunnyneo.com/petimagefinder.php and enter your pet's name. It's image should show up. Then, find the link below the pet's image, and copy it to your message!").then(message.channel.sendFile('./images/PetID.png').then(message.channel.send("It's recommended you keep this ID with you so you can easily share your pet's picture without having to repeat these steps."))); } else { diff --git a/commands/search/yugioh.js b/commands/search/yugioh.js index c754301d..4c76082a 100644 --- a/commands/search/yugioh.js +++ b/commands/search/yugioh.js @@ -18,7 +18,7 @@ module.exports = class YuGiOhCommand extends commando.Command { if(!message.channel.permissionsFor(this.client.user).hasPermission(['SEND_MESSAGES', 'READ_MESSAGES', 'EMBED_LINKS'])) return; } console.log("[Command] " + message.content); - let cardName = message.content.split(" ").slice(1).join("%20"); + let cardName = encodeURI(message.content.split(" ").slice(1).join(" ")); request .get('http://yugiohprices.com/api/card_data/' + cardName) .then(function (response) {