git ssb

3+

ev / starboard



Tree: ee66696629dc72e9da2c959f1baa0c55642d1aa4

Files: ee66696629dc72e9da2c959f1baa0c55642d1aa4 / x.js

868 bytesRaw
1var pull = require('pull-stream')
2var paramap = require('pull-paramap')
3var ssbClient = require('ssb-client')
4var avatar = require('ssb-avatar')
5var render = require('./render')
6
7var listMessages = function () {
8 var number = process.argv[2]
9 var type = process.argv[3]
10
11 ssbClient(function (err, sbot) {
12 if (err) throw err
13 sbot.whoami(function getId(err, me) {
14 if (err) throw err
15 pull(
16 sbot.messagesByType({
17 type: type,
18 limit: Number(number),
19 reverse: true
20 }),
21 paramap(function getAvatar(msg, cb) {
22 avatar(sbot, me.id, msg.value.author, function (err, avatar) {
23 if (err) throw err
24 msg.avatar = avatar
25 cb(null, msg)
26 })
27 }),
28 pull.drain(function (msg) {
29 render(msg)
30 })
31 )
32 })
33 })
34}
35
36listMessages()
37

Built with git-ssb-web