/pinyin-bot-core

Core module for my Telegram bot and my Messenger bot.

Primary LanguageJavaScriptMIT LicenseMIT

Pinyin Bot Core

npm version Travis Build Status Greenkeeper badge dependency status dev dependency status MIT-licensed chat on gitter

Install

npm install pinyin-bot-core

Usage

const botCore = require('pinyin-bot-core')

// Default
botCore.processMessage('你的中文很好啊')
.then(console.log)  // nǐ de zhōng wén hěn hǎo a

// Pinyin (/p | /pinyin)
botCore.processMessage('/p 你的中文很好啊')
.then(console.log)  // nǐ de zhōng wén hěn hǎo a

botCore.processMessage('/p nǐ de zhōng wén hěn hǎo a')
.then(console.log)  // ni3 de zhong1 wen2 hen3 hao3 a

botCore.processMessage('/p ni3 de zhong1 wen2 hen3 hao3 a')
.then(console.log)  // nǐ de zhōng wén hěn hǎo a

// Split (/s | /split)
botCore.processMessage('/s nidezhongwenhenhaoa')
.then(console.log)  // ni de zhong wen hen hao a

botCore.processMessage('/s nǐdezhōngwénhěnhǎoa')
.then(console.log)  // nǐ de zhōng wén hěn hǎo a

botCore.processMessage('/s ni3dezhong1wen2hen3hao3a')
.then(console.log)  // ni3 de zhong1 wen2 hen3 hao3 a

Related

Contributing

If you have a question, found a bug or want to propose a feature, have a look at the issues page.