How to use the node-emoji.unemojify function in node-emoji

To help you get started, we’ve selected a few node-emoji examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github peterthehan / holo / src / commands / users.js View on Github external
database.ref(`guilds/${message.guild.id}/messages`).once('value', (snapshot) => {
      const db = snapshot.val();
      if (!db) {
        error(message, '', `My records are empty!`);
        return;
      }

      // determine emoji
      filter = emoji.hasEmoji(filter)
        ? emoji.unemojify(filter)
        : filter.match(/:\d+>/)[0];
      filter = filter.substring(1, filter.length - 1);

      usersInfo(message, db, filter);
    }, (errorObject) => {
      console.log('The read failed: ' + errorObject.code);
github bjork24 / google-calendar-slack-status / index.js View on Github external
app.post('/', (req, res, next) => {
  // check for secret token
  if (!req.body.token || req.body.token !== process.env.SECRET_TOKEN) {
    next();
    return;
  }
  // store token
  const token = process.env.SLACK_TOKEN;
  // log some stuff for dev
  console.log(req.body);
  // grab status and emojis and clean it up
  let status = req.body.title;
  let statusEmoji = nodeEmoji.unemojify('🗓');
  const statusHasEmoji = emojiRegex().exec(status);
  if (statusHasEmoji) {
    statusEmoji = nodeEmoji.unemojify(statusHasEmoji[0]);
    console.log(`CUSTOM EMOJI! ${statusEmoji}`);
    status = nodeEmoji.strip(status);
  }
  // additional tokens
  const dndToken = '[DND]';
  const awayToken = '[AWAY]';
  // parse event start/stop time
  const dateFormat = 'MMM D, YYYY [at] hh:mmA';
  const start = moment(req.body.start, dateFormat);
  const end = moment(req.body.end, dateFormat);
  // check for DND
  if (status.includes(dndToken)) {
    slack.dnd.setSnooze({
      token,
      num_minutes: end.diff(start, 'minutes')
    });
github mongrov / roverz / src / chat / ui / room / MessageImageView.js View on Github external
onSend(messages = []) {
    /* [ { text: 'Hello', user: { _id: 'wKk3sXsCYvTkXJeLY' }, createdAt: Wed Jun 07 2017 00:26:46 GMT-0700 (PDT),
       _id: 'e6fa1c61-e77d-4935-aefd-9ee3e10bbdb1' } ] */
    // lets not send an empty message
    if (messages.length > 0 && messages[0].text && messages[0].text.trim().length > 0) {
      const unEmoMsg = emoji.unemojify(messages[0].text.trim());
      this._network.service.replyMessage(this._group, this.state.msgId, unEmoMsg);
    }
  }
github mongrov / roverz / src / chat / ui / room / RoomView.js View on Github external
onSend() {
    if (this.state.text.trim().length > 0) {
      const unEmoMsg = emoji.unemojify(this.state.text.trim());
      this._network.service.sendMessage(
        this._group,
        unEmoMsg,
      );
      this.setState({
        text: '',
        height: 44,
      });
    }
  }
github momocow / semantic-release-gitmoji / lib / helper / release-notes.js View on Github external
push (emoji, message) {
    emoji = unemojify(emoji)
    message = unemojify(message).replace(new RegExp('^' + emoji), '')

    if (!this._commits.has(emoji)) this._commits.set(emoji, [])
    this._commits.get(emoji).push(message)

    return this
  }
github iotaledger / documentation-platform / buildProjects.js View on Github external
async function emojiChars(markdown, docPath) {
    const re = emojiRegex();

    let match;
    do {
        match = re.exec(markdown);

        if (match) {
            await reportWarning(`Emoji ${match[0]}  ${emojiUnicode(match[0])} should be converted to Markdown ${emoji.unemojify(match[0])} in '${docPath}'`);
        }
    } while (match);

    return markdown;
}
github momocow / semantic-release-gitmoji / lib / helper / release-notes.js View on Github external
push (emoji, message) {
    emoji = unemojify(emoji)
    message = unemojify(message).replace(new RegExp('^' + emoji), '')

    if (!this._commits.has(emoji)) this._commits.set(emoji, [])
    this._commits.get(emoji).push(message)

    return this
  }
github frinyvonnick / gitmoji-changelog / packages / gitmoji-changelog-core / src / parser.js View on Github external
function parseSubject(subject) {
  if (!subject) return {}

  const unemojified = nodeEmoji.unemojify(subject)

  const matches = unemojified.match(/:(\w*):(.*)/)

  if (matches) {
    const [, emojiCode, message] = matches

    if (nodeEmoji.hasEmoji(emojiCode)) {
      return {
        emojiCode,
        emoji: nodeEmoji.get(emojiCode),
        message: nodeEmoji.emojify(message.trim()),
      }
    }
  }

  return {
github peterthehan / holo / src / util / parseEmojis.js View on Github external
const reactionEmojis = collected.keyArray().map(i => {
      if (emoji.hasEmoji(i)) {
        const unemojified = emoji.unemojify(i);
        return unemojified.substring(1, unemojified.length - 1);
      }
      return i;
    });