-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapp.js
33 lines (27 loc) · 1009 Bytes
/
app.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
// Node requirements
const path = require('path');
// Bot setup
const Botmaster = require('botmaster');
const TwitterBot = require('botmaster-twitter-dm');
const twitterSettings = require(path.resolve(__dirname, 'config'));
const botmaster = new Botmaster();
const twitterBot = new TwitterBot(twitterSettings);
botmaster.addBot(twitterBot);
// Own requirements: controllers, messages
const messages = require(path.resolve(__dirname, 'messages', 'index'));
let myIncomingMiddlewareController = (bot, update) => {
if (update.message.text === 'hi' ||
update.message.text === 'Hi' ||
update.message.text === 'hello' ||
update.message.text === 'Hello' ||
update.message.text === 'yo' ||
update.message.text === 'Hey' ||
update.message.text === 'hey') {
bot.sendTextCascadeTo(messages.tutorial, update.sender.id);
}
};
botmaster.use({
type: 'incoming',
name: 'My incoming middleware',
controller: myIncomingMiddlewareController,
});