send the message!
This commit is contained in:
6
bot.js
6
bot.js
@@ -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 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
|
||||
//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)
|
||||
console.log('image url list:' + image_url_list);
|
||||
//console.log('image url list:' + image_url_list);
|
||||
|
||||
if (image_url_list) {
|
||||
return image_url_list[getRandomInt(0, image_url_list - 1)];
|
||||
@@ -684,10 +683,11 @@ client.on('message', message => {
|
||||
break;
|
||||
|
||||
case 'async':
|
||||
asyncImageRequest(message)
|
||||
let link = asyncImageRequest(message)
|
||||
.catch(error => {
|
||||
sendToBotTestingChannel('async:' + error.message);
|
||||
});
|
||||
message.channel.send(link);
|
||||
break;
|
||||
|
||||
// Voice commands
|
||||
|
Reference in New Issue
Block a user