-
Notifications
You must be signed in to change notification settings - Fork 0
/
app.js
116 lines (92 loc) · 2.01 KB
/
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
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
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
const express = require("express");
const bodyParser = require("body-parser");
//var mongoose = require("mongoose");
const images = {
{
image: '/public/images/beer.jpg',
emoji: '🍺'
},
{
image: '/public/images/beer.jpg',
emoji: '🍷'
},
{
image: '/public/images/pizza.jpg',
emoji: '🍕'
},
{
image: '/public/images/burger.jpg',
emoji: '🍔'
},
{
image: '/public/images/umbrella.jpg',
emoji: '🌂'
},
{
image: '/public/images/sunnies.jpg',
emoji: '🕶'
},
{
image: '/public/images/fried-egg.jpg',
emoji: '🍳'
message: 'Sunny side up!'
},
{
image: '/public/images/balloons.jpg',
emoji: '🎈'
message: 'Fly my little bird!'
},
{
image: '/public/images/banana.jpg',
emoji: '🍌'
message: 'Eat this!'
},
{
image: '/public/images/ketcher.jpg',
emoji: '🎾'
message: 'This is a harder one.'
},
}
🍷🍕🍔🌂
// Start our express app
const app = express();
// A middleware to parse incoming request bodies.
app.use(bodyParser.urlencoded({extended: false}));
app.use(bodyParser.json());
// Listen to the port
app.listen((process.env.PORT || 5000));
// Server index page
app.get("/", function (req, res) {
res.send("We're up and running! Yay! :D ");
});
/**
* Facebook Webhook varification
*/
// app.get("/webhook", function (req, res) {
// });
/**
* All callbacks from messenger will be posted here
*/
// app.post("/webhook", function (req, res) {
// Figure out what to do depending on the request (postback / message)
// });
/**
* Process postbacks
* This is when the user clicks a button. Either the "Get started" button, or buttons that we set up via messages.
*
*/
function processPostback(event) {
}
/**
* Process messages
* This is when the user writes something to us.
* This function needs to know image we're currently waiting for a match to. And weather or not we started the game.
*/
function processMessage(event) {
}
/**
* Check if emoji matches image
*/
function emojiMatchesDrawing(emoji, drawingId) {
return true;
}