Files: ee66696629dc72e9da2c959f1baa0c55642d1aa4 / seven.js
782 bytesRaw
1 | var pull = require('pull-stream') |
2 | var paramap = require('pull-paramap') |
3 | var ssbClient = require('ssb-client') |
4 | var avatar = require('ssb-avatar') |
5 | var render = require('./render') |
6 | |
7 | var listMessages = function () { |
8 | ssbClient(function (err, sbot) { |
9 | if (err) throw err |
10 | sbot.whoami(function getId(err, me) { |
11 | if (err) throw err |
12 | pull(sbot.messagesByType({ |
13 | type: 'post', |
14 | limit: 7, |
15 | reverse: true |
16 | }), |
17 | paramap(function getAvatar(msg, cb) { |
18 | avatar(sbot, me.id, msg.value.author, function (err, avatar) { |
19 | if (err) throw err |
20 | msg.avatar = avatar; |
21 | cb(null, msg) |
22 | }) |
23 | }), |
24 | pull.drain(function printMessage(msg) { |
25 | render(msg) |
26 | sbot.close(); |
27 | }) |
28 | ) |
29 | }) |
30 | }) |
31 | } |
32 | |
33 | listMessages(); |
34 |
Built with git-ssb-web