send the message!

This commit is contained in:
Dalton
2018-12-12 20:43:30 -08:00
parent 3eab8afb5f
commit edfb4e2c45

6
bot.js
View File

@@ -264,12 +264,11 @@ async function asyncImageRequest(channelMessage) {
let reddit_json = await loadJson("https://www.reddit.com/r/" + requested_item + "/.json?show=all&count=25&limit=100"); let reddit_json = await loadJson("https://www.reddit.com/r/" + requested_item + "/.json?show=all&count=25&limit=100");
let imgur_json = await loadJson('https://api.imgur.com/3/gallery/r/' + requested_item + '/time/' + getRandomInt(1, 5), auth.imgur); let imgur_json = await loadJson('https://api.imgur.com/3/gallery/r/' + requested_item + '/time/' + getRandomInt(1, 5), auth.imgur);
//console.log('imgur_json -> ' + JSON.stringify(imgur_json));
// todo need to check config to see if it's a valid booruuuuu // todo need to check config to see if it's a valid booruuuuu
//let redditbooru_json = await loadJson("https://" + requested_item + ".redditbooru.com/images/?limit=1000"); //let redditbooru_json = await loadJson("https://" + requested_item + ".redditbooru.com/images/?limit=1000");
image_url_list = image_url_list.concat(getUrlListFromReddit(reddit_json), getUrlListFromImgur(imgur_json)); //, getUrlListFromRedditBooru(redditbooru_json) image_url_list = image_url_list.concat(getUrlListFromReddit(reddit_json), getUrlListFromImgur(imgur_json)); //, getUrlListFromRedditBooru(redditbooru_json)
console.log('image url list:' + image_url_list); //console.log('image url list:' + image_url_list);
if (image_url_list) { if (image_url_list) {
return image_url_list[getRandomInt(0, image_url_list - 1)]; return image_url_list[getRandomInt(0, image_url_list - 1)];
@@ -684,10 +683,11 @@ client.on('message', message => {
break; break;
case 'async': case 'async':
asyncImageRequest(message) let link = asyncImageRequest(message)
.catch(error => { .catch(error => {
sendToBotTestingChannel('async:' + error.message); sendToBotTestingChannel('async:' + error.message);
}); });
message.channel.send(link);
break; break;
// Voice commands // Voice commands