@chatopera/ms-message

Manuscript Message Object

no longer maintainence
Last updated 2 years ago by chatopera .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install @chatopera/ms-message 
SYNC missed versions from official npm registry.

Message Object for SuperScript

This module creates message objects for SuperScript to consume.

You can add your own plugins to extend the message object to add extra properties to the message. For example, you might want to write a plugin that calls an external NLP service like wit.ai, or a plugin that does sentiment analysis on the message. Then, later reply plugin functions can use this extra information to do things like filter replies or add text programmatically to a reply.

API

  • createMessage(message, options, callback)

message is the original text to create a message with. options can have factSystem, scope and lang.

lang can only be set with "zh_CN" or "en_US" by now, "en_US" as used as default value.

  • loadPlugins(path)

path is a directory path of files of plugins to load.

### Example plugin

An example plugin might look something like this:

const addWords = function addWords(cb) {
  this.message.words = this.message.clean.split(' ');
  cb();
};

This simply add a words property to the message, so you could, say, filter out messages that weren't long or short enough in SuperScript.

Current Tags

  • 2.0.3                                ...           latest (2 years ago)

5 Versions

  • 2.0.3 [deprecated]           ...           2 years ago
  • 2.0.2                                ...           2 years ago
  • 2.0.1                                ...           2 years ago
  • 2.0.0                                ...           2 years ago
  • 1.1.2                                ...           2 years ago
Downloads
Today 0
This Week 6
This Month 6
Last Day 0
Last Week 1
Last Month 8
Dependencies (11)
Dev Dependencies (12)

Copyright 2014 - 2016 © taobao.org |