pr0gag parser

This commit is contained in:
Flummi 2018-09-02 17:40:04 +02:00
parent 179936f493
commit 04f4f36a5e
2 changed files with 13 additions and 4 deletions

View File

@ -10,7 +10,8 @@ import EventEmitter from "events";
const colors = {
red: "\x0304$1\x0304",
blue: "\x0312$1\x0312",
yellow: "\x0308$1\x0308"
yellow: "\x0308$1\x0308",
green: "\x0303$1\x0303"
};
const msgmodes = {
normal: "PRIVMSG {recipient} :{msg}",

View File

@ -45,25 +45,33 @@ export default bot => {
down: list.down,
score: list.up - list.down,
ratio: (list.up / (list.up + list.down)).toFixed(2),
flags: flags[list.flags],
flag: flags[list.flags],
user: list.user,
comments: item.comments.length,
toptags: item.tags.splice(0, 3).map(tag => tag.tag),
link: site + id.toString()
}))
.then(meta => [
meta.link,
`${meta.score} ([color=green]${meta.up}[/color] / [color=red]${meta.down}[/color])`,
`user: ${meta.user}`,
`comments: ${meta.comments}`,
`toptags: ${meta.toptags.join(", ")} (${meta.flag})`
])
.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.flags}`,
`f: ${meta.flag}`,
`u: ${meta.user}`,
`co: ${meta.comments}`,
`t: ${meta.toptags}`,
`l: ${meta.link}`
].join("; "))
.then(out => e.reply(out))
.then(out => e.reply(out))*/
).catch(err => e.reply(err));
}
}));