This commit is contained in:
Flummi 2018-09-02 17:50:09 +02:00
parent 34ea115260
commit b695c42b98

View File

@ -22,7 +22,7 @@ export default bot => {
call: /(vid|img)\.pr0gramm\.com.*/i, call: /(vid|img)\.pr0gramm\.com.*/i,
set: "uwe", set: "uwe",
f: e => { f: e => {
const link = "https://"+e.message.match(regex)[0]; const link = "https://" + e.message.match(regex)[0];
const tmp = url.parse(link).path.substr(1); const tmp = url.parse(link).path.substr(1);
rp(apis.reverse + tmp) rp(apis.reverse + tmp)
.then(res => { .then(res => {
@ -48,7 +48,10 @@ export default bot => {
flag: flags[list.flags], flag: flags[list.flags],
user: list.user, user: list.user,
comments: item.comments.length, comments: item.comments.length,
toptags: item.tags.splice(0, 3).map(tag => tag.tag), toptags: item.tags
.sort((a, b) => a.confidence - b.confidence)
.splice(0, 3)
.map(tag => tag.tag),
link: site + id.toString() link: site + id.toString()
})) }))
.then(meta => [ .then(meta => [
@ -59,19 +62,6 @@ export default bot => {
`toptags: ${meta.toptags.join(", ")} (${meta.flag})` `toptags: ${meta.toptags.join(", ")} (${meta.flag})`
]) ])
.then(out => e.reply(out.join(" - "))) .then(out => e.reply(out.join(" - ")))
/*.then(meta => [
`c: ${meta.created}`,
`u: ${meta.up}`,
`d: ${meta.down}`,
`s: ${meta.score}`,
`r: ${meta.ratio}`,
`f: ${meta.flag}`,
`u: ${meta.user}`,
`co: ${meta.comments}`,
`t: ${meta.toptags}`,
`l: ${meta.link}`
].join("; "))
.then(out => e.reply(out))*/
).catch(err => e.reply(err)); ).catch(err => e.reply(err));
} }
})); }));