forked from Supositware/Haha-Yes
Loop until it found a threads
This commit is contained in:
parent
1ea32f53a6
commit
fd6c1b57c5
1 changed files with 5 additions and 0 deletions
|
@ -44,6 +44,11 @@ class FourchanCommand extends Command {
|
||||||
|
|
||||||
i = Math.floor((Math.random() * response.threads.length) + 1);
|
i = Math.floor((Math.random() * response.threads.length) + 1);
|
||||||
|
|
||||||
|
// Loop until it found a threads
|
||||||
|
while(!response.threads[i]) {
|
||||||
|
i = Math.floor((Math.random() * response.threads.length) + 1);
|
||||||
|
}
|
||||||
|
|
||||||
// If post is sticky search again
|
// If post is sticky search again
|
||||||
while(response.threads[i].posts[0].sticky == 1 || !response.threads[i].posts) {
|
while(response.threads[i].posts[0].sticky == 1 || !response.threads[i].posts) {
|
||||||
i = Math.floor((Math.random() * response.threads.length));
|
i = Math.floor((Math.random() * response.threads.length));
|
||||||
|
|
Loading…
Reference in a new issue