Should not show sticky post

This commit is contained in:
Loïc Bersier 2019-06-26 04:32:56 +02:00
parent 6c67cd5a79
commit eaa439f68c

View file

@ -40,13 +40,17 @@ class FourchanCommand extends Command {
let i = Math.floor((Math.random() * response.threads.length)); let i = Math.floor((Math.random() * response.threads.length));
while(response.threads[i].posts[0].sticky == 1) {
i = Math.floor((Math.random() * response.threads.length));
}
let description = response.threads[i].posts[0].com; let description = response.threads[i].posts[0].com;
description = decodeURI(description);
let regex = /(<([^>]+)>)/ig; let regex = /(<([^>]+)>)/ig;
if (regex.test(description)) { if (regex.test(description)) {
description = response.threads[i].posts[0].com.replace(/(<([^>]+)>)/ig,''); description = response.threads[i].posts[0].com.replace(/(<([^>]+)>)/ig,'');
} }
description = decodeURI(description);
const FourchanEmbed = new MessageEmbed() const FourchanEmbed = new MessageEmbed()
.setColor('#ff9900') .setColor('#ff9900')