From 1fed851def662e59302646ac102d03943f2a681d Mon Sep 17 00:00:00 2001 From: Remco Date: Wed, 16 Dec 2015 11:20:21 +0100 Subject: [PATCH] hi --- discord_bot.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/discord_bot.js b/discord_bot.js index 096276e..91bc4dd 100644 --- a/discord_bot.js +++ b/discord_bot.js @@ -411,7 +411,7 @@ var commands = { //gets us a random result in first 5 pages var page = 1 + Math.floor(Math.random() * 5) * 10; //we request 10 items var request = require("request"); - request("https://www.googleapis.com/customsearch/v1?key=" + ConfigFile.youtube_api_key + "&cx=" + ConfigFile.google_custom_search + "&q=" + (args.replace(/\s/g, '+')) + "&searchType=image&alt=json&num=10&start="+page, function(err, res, body) { + request("https://www.googleapis.com/customsearch/v1?key=" + ConfigFile.youtube_api_key + "&cx=" + ConfigFile.google_custom_search + "&q=" + (suffix.replace(/\s/g, '+')) + "&searchType=image&alt=json&num=10&start="+page, function(err, res, body) { var data, error; try { data = JSON.parse(body); @@ -426,7 +426,7 @@ var commands = { } else if (!data.items || data.items.length == 0){ console.log(data); - bot.sendMessage(msg.channel, "No result for '" + args + "'"); + bot.sendMessage(msg.channel, "No result for '" + suffix + "'"); return; } var randResult = data.items[Math.floor(Math.random() * data.items.length)];