forked from Supositware/Haha-Yes
nvm i DO need you
This commit is contained in:
parent
78e1457b11
commit
4fb3d4dbdb
1 changed files with 11 additions and 4 deletions
|
@ -44,14 +44,21 @@ class FourchanCommand extends Command {
|
||||||
i = Math.floor((Math.random() * response.threads.length));
|
i = Math.floor((Math.random() * response.threads.length));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let description = response.threads[i].posts[0].com;
|
||||||
|
description = decodeURI(description);
|
||||||
|
|
||||||
|
let regex = /(<([^>]+)>)/ig;
|
||||||
|
if (regex.test(description)) {
|
||||||
|
description = response.threads[i].posts[0].com.replace(/(<([^>]+)>)/ig,'');
|
||||||
|
}
|
||||||
|
|
||||||
const FourchanEmbed = new MessageEmbed()
|
const FourchanEmbed = new MessageEmbed()
|
||||||
.setColor('#ff9900')
|
.setColor('#ff9900')
|
||||||
.setTitle(`${response.threads[i].posts[0].name} | ${response.threads[i].posts[0].no}`)
|
.setTitle(response.threads[i].posts[0].sub)
|
||||||
.setDescription(response.threads[i].posts[0].sub)
|
.setDescription(description)
|
||||||
.setImage(`https://i.4cdn.org/${args.board}/${response.threads[i].posts[0].tim}${response.threads[i].posts[0].ext}`)
|
.setImage(`https://i.4cdn.org/${args.board}/${response.threads[i].posts[0].tim}${response.threads[i].posts[0].ext}`)
|
||||||
.setURL(`https://boards.4chan.org/${args.board}/thread/${response.threads[i].posts[0].no}/${response.threads[i].posts[0].semantic_url}`)
|
.setURL(`https://boards.4chan.org/${args.board}/thread/${response.threads[i].posts[0].no}/${response.threads[i].posts[0].semantic_url}`)
|
||||||
.setFooter(`${boards.getName(args.board)} | ${response.threads[i].posts[0].now}`)
|
.setFooter(`${boards.getName(args.board)} | ${response.threads[i].posts[0].name} | ${response.threads[i].posts[0].no} | ${response.threads[i].posts[0].now}`);
|
||||||
.setTimestamp();
|
|
||||||
|
|
||||||
if (response.threads[i].posts[0].ext == '.webm' || response.threads[i].posts[0].ext == '.pdf' || response.threads[i].posts[0].ext == '.swf') {
|
if (response.threads[i].posts[0].ext == '.webm' || response.threads[i].posts[0].ext == '.pdf' || response.threads[i].posts[0].ext == '.swf') {
|
||||||
message.channel.send(FourchanEmbed);
|
message.channel.send(FourchanEmbed);
|
||||||
|
|
Loading…
Reference in a new issue