Skip to content
This repository has been archived by the owner on Feb 26, 2018. It is now read-only.

Commit

Permalink
hi
Browse files Browse the repository at this point in the history
  • Loading branch information
Remco authored and Remco committed Dec 16, 2015
1 parent ff194db commit 1fed851
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions discord_bot.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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)];
Expand Down

0 comments on commit 1fed851

Please sign in to comment.