Skip to content

Create your own Line bot with registering a RegExp to test against an incomming text message

License

Notifications You must be signed in to change notification settings

heretse/node-linebot-wrapper

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

node-linebot-wrapper

Create your own Line bot with registering a RegExp to test against an incomming text message

Installation

npm install node-linebot-wapper --save

Usage

Example

var LineBotWrapper = require('node-linebot-wrapper');

...

var lineBot = new LineBotWrapper(
	'Your channel id',
    'Your channel secret',
    'Your channel access token',
    {onlyFirstMatch: true});

app.post('/', lineBot.getParser());
app.get('/', function(req, res) {
    res.send("Server is running");
});

...

lineBot.onText(/\/cal (.+)/, function(eventOrMsg, match) {
    var regex = /\/cal (.+)/;
    var respMsg = match[1].replace(/[^-()\d/*+.]/g, '');
    respMsg = 'result: ' + eval(respMsg);

    replyMessage(eventOrMsg, respMsg);
});

...

About

Create your own Line bot with registering a RegExp to test against an incomming text message

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published