forked from Testlio/lunchbot
-
Notifications
You must be signed in to change notification settings - Fork 1
/
index.js
85 lines (65 loc) · 2.38 KB
/
index.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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
// index.js
var LunchBot = require('./lib/lunchbot');
var FacebookSource = require('./lib/sources/facebook');
var luncherSource = require('./lib/sources/luncher');
var Parsers = require('./lib/parsers');
var Filters = require('./lib/filters');
var config = require('config');
var Promise = require('bluebird');
var token = config.get('slack.api');
var name = config.get('slack.name');
process.on('uncaughtException', function(err) {
console.log(err);
});
process.on('exit', function() {
console.log('Process exiting');
});
var bot = new LunchBot({
token: token,
name: name,
usesReactionVoting: config.get('slack.usesReactionVoting')
});
var params = {
chains: [
{
parser: Parsers.weeklyMenu,
filter: Filters.startOfWeek
},
{
parser: Parsers.basicPrice,
filter: Filters.sameDay
}
]
};
//
// Sources
//
// La Tabla
const latabla = new FacebookSource('es', 'La Tabla', "827767180609816", params);
// KPK
const kpk = new FacebookSource('scissors', 'Kivi Paber Käärid', 'kivipaberkaarid', params);
// Apelsini Raudtee
const apelsin = new FacebookSource('tangerine', 'Apelsini Raudtee', 'apelsiniraudtee', params);
// F-Hoone
const fhoone = new FacebookSource('house', 'F-Hoone', 'Fhoone', params);
// Kukeke, occassionally has an offer posted
const kukeke = new FacebookSource('rooster', 'Kukeke', 'kukekene', params);
// Trühvel, special because only posts once a week (on Mondays)
const truhvel = new FacebookSource('coffee', 'Trühvel', '1829502837275034', params);
// Kohvik Sõbrad
const buddies = new FacebookSource('two_men_holding_hands', 'Kohvik Sõbrad', 'kohviksobrad', params);
// Frenchy
const frenchy = new FacebookSource('fr', 'Frenchy', '593232130762873', params);
// Sesoon
const sesoon = new FacebookSource('eggplant', 'Kohvik Sesoon', 'KohvikSesoon', params);
const luncherServices = [
['steam_locomotive', 'Perrooni Kohvik', '5795c85ec7e7ff48390001eb'],
['tea', 'Telliskivi Reval Café', '575ea00fc7e7ff483900004b'],
['poultry_leg', 'Telliskivi 15', '5761148ec7e7ff4839000081']
].map(function(service) {
return luncherSource.apply(null, service);
});
const services = [latabla, kpk, apelsin, fhoone, truhvel, kukeke, buddies, frenchy, sesoon].concat(luncherServices);
console.log('Starting LunchBot with ' + services.length + ' services');
bot.services = services;
bot.run();