Files: f1cc08ac986f18880000b780dae6fb2043e76948 / modules / suggest-emoji.js
710 bytesRaw
1 | var emojiNames = require('./helpers').emojinames |
2 | |
3 | var config = require('../config')() |
4 | |
5 | exports.gives = 'suggest_mentions' |
6 | |
7 | exports.create = function (api) { |
8 | return function (word) { |
9 | return function (cb) { |
10 | if (word[0] !== ':' || word.length < 2) return cb() |
11 | word = word.substr(1) |
12 | if (word[word.length-1] === ':') word = word.substr(0, word.length-1) |
13 | cb(null, emojiNames().filter(function (name) { |
14 | return name.substr(0, word.length) === word |
15 | }).slice(0, 50).map(function (emoji) { |
16 | return { |
17 | image: config.emojiUrl + emoji + '.png', |
18 | title: emoji, |
19 | subtitle: emoji, |
20 | value: ':' + emoji + ':' |
21 | } |
22 | })) |
23 | } |
24 | } |
25 | |
26 | } |
27 |
Built with git-ssb-web