Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
42 commits
Select commit Hold shift + click to select a range
ac922fb
update
baonguyen2604 Apr 15, 2018
3b53b35
fix
thinhnguyennt7 Apr 16, 2018
adfe5fc
fix
thinhnguyennt7 Apr 16, 2018
df2eeb5
team squad
thinhnguyennt7 Apr 16, 2018
1a33094
squad
thinhnguyennt7 Apr 16, 2018
67632a7
squad
thinhnguyennt7 Apr 16, 2018
5f15c91
fix
thinhnguyennt7 Apr 16, 2018
26ee393
new Quick reply
thinhnguyennt7 Apr 16, 2018
43f246c
add func
thinhnguyennt7 Apr 16, 2018
e795558
update squad
thinhnguyennt7 Apr 16, 2018
7231faf
fix squad
thinhnguyennt7 Apr 16, 2018
78bd082
update goback
thinhnguyennt7 Apr 16, 2018
6357087
fix squad
thinhnguyennt7 Apr 16, 2018
d80a191
fix squad
thinhnguyennt7 Apr 16, 2018
b915c96
fix squad string
thinhnguyennt7 Apr 17, 2018
b039105
fix squad string
thinhnguyennt7 Apr 17, 2018
174b31f
fix squad
thinhnguyennt7 Apr 17, 2018
1ac383a
team schedule
thinhnguyennt7 Apr 17, 2018
29cbb2b
fix schedule
thinhnguyennt7 Apr 17, 2018
8fd3373
fix schedule
thinhnguyennt7 Apr 21, 2018
5c0a480
fix real madrid
thinhnguyennt7 Apr 21, 2018
4095f25
fix timeout
thinhnguyennt7 Apr 21, 2018
0c5d716
fix schedule underfine at some team
thinhnguyennt7 Apr 29, 2018
8280f93
fix underfine
thinhnguyennt7 Apr 29, 2018
78481ff
fix
thinhnguyennt7 Apr 29, 2018
28e4d3f
debugging
thinhnguyennt7 Apr 29, 2018
dffe02c
debugging
thinhnguyennt7 Apr 29, 2018
bc1b384
new version team news
thinhnguyennt7 Apr 30, 2018
8ea753c
increase implicitly wait
thinhnguyennt7 Apr 30, 2018
59e35db
debugging by 1 news
thinhnguyennt7 Apr 30, 2018
636083a
add 1 more news
thinhnguyennt7 Apr 30, 2018
4b73015
fix news
thinhnguyennt7 Apr 30, 2018
12363d5
testing
thinhnguyennt7 Apr 30, 2018
30c1089
fix
thinhnguyennt7 Apr 30, 2018
4980247
fix
thinhnguyennt7 Apr 30, 2018
c0a5d37
fix
thinhnguyennt7 Apr 30, 2018
696e4e5
add array
thinhnguyennt7 Apr 30, 2018
d953b34
https
thinhnguyennt7 Apr 30, 2018
0c99e11
http
thinhnguyennt7 Apr 30, 2018
62f4218
compact
thinhnguyennt7 Apr 30, 2018
52424dd
fix script teamNews
thinhnguyennt7 May 8, 2018
4fecfe7
delete list view
thinhnguyennt7 May 8, 2018
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions app.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ const bodyParser = require('body-parser');
const app = express();
const webhooks = require('./routes/webhooks');

// endpoint
//endpoint
app.get('/', (req, res) => {
res.send('Server ON!');
res.send('Server ON!');
})

// Sets server port and logs message on success
Expand Down
42 changes: 42 additions & 0 deletions data/get_data.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,47 @@ module.exports = {
spawn('killall', ['-9', 'chromedriver']);
callback(err, data);
})
},
get_team_squad: function (team_name, callback) {
PythonShell.run('./scripts/get_team_squad.py', {args: [team_name]}, (err, data) => {
spawn('killall', ['-9', 'chrome']);
spawn('killall', ['-9', 'chromedriver']);
callback(err, data);
})
},
get_team_schedule: function (team_name, callback) {
PythonShell.run('./scripts/get_team_schedule.py', {args: [team_name]}, (err, data) => {
spawn('killall', ['-9', 'chrome']);
spawn('killall', ['-9', 'chromedriver']);
callback(err, data);
})
},
get_team_news: function (team_name, callback) {
PythonShell.run('./scripts/get_team_news.py', {args: [team_name]}, (err, data) => {
spawn('killall', ['-9', 'chrome']);
spawn('killall', ['-9', 'chromedriver']);
callback(err, data);
})
},
get_team_coach: function (team_name, callback) {
PythonShell.run('./scripts/get_team_coach.py', {args: [team_name]}, (err, data) => {
spawn('killall', ['-9', 'chrome']);
spawn('killall', ['-9', 'chromedriver']);
callback(err, data);
})
},
get_team_video: function (team_name, callback) {
PythonShell.run('./scripts/get_team_video.py', {args: [team_name]}, (err, data) => {
spawn('killall', ['-9', 'chrome']);
spawn('killall', ['-9', 'chromedriver']);
callback(err, data);
})
},
get_player_news: function (team_name, callback) {
PythonShell.run('./scripts/get_player_news.py', {args: [player_name]}, (err, data) => {
spawn('killall', ['-9', 'chrome']);
spawn('killall', ['-9', 'chromedriver']);
callback(err, data);
})
}
};
74 changes: 74 additions & 0 deletions data/teamName.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,81 @@
"Paris Saint Germain": ["Paris Saint Germain", "PSG", "Paris Saint", "Paris Germain", "ParisSG", "Germain"],
"Juventus": ["Juventus", "Juve", "Juv"],
"Bayern Munich": ["Bayern Munich", "Bayern M", "Munich", "BAY"],
"Bayer Leverkusen": ["Bayer Leverkusen", "Bayer", "Leverkusen"],
"Borrusia Moenchengladbach": ["Borrusia Moenchengladbach", "Moenchengladbach", "Borrusia"],
"Cologne": ["Cologne"],
"Eintracht Frankfurt": ["Eintracht Frankfurt", "Eintracht", "Frankfurt"],
"FC Augsburg": ["FC Augsburg", "Augsburg"],
"Freiburg": ["Freiburg"],
"Hamburg SV": ["Hamburg SV", "Hamburg"],
"Hanover 96": ["Hanover 96"],
"Hertha Berlin": ["Hertha Berlin", "Hertha"],
"Hoffenheim": ["Hoffenheim"],
"Mainz": ["Mainz"],
"RB Leipzig": ["RB Leipzig", "Leipzig", "RL"],
"Schalke 04": ["Schalke 04", "Schalke"],
"VfB Stuttgart": ["VfB Stuttgart", "VfB", "Stuttgart", "VS"],
"VfL Wolfsburg": ["VfL Wolfsburg", "VfL", "Wolfsburg", "VW"],
"Werder Bremen": ["Werder Bremen", "Werder", "Bremen"],
"Arminia Bielefeld": ["Arminia Bielefeld", "Arminia", "Bielefeld", "AB", "Bie"],
"Darmstadt 98": ["Darmstadt 98", "Darmstadt", "DAR"],
"Dynamo Dresden": ["Dynamo Dresden", "Dynamo", "Dresden", "DRE"],
"Eintracht Braunschweig": ["Eintracht Braunschweig", "Eintracht", "Braunschweig", "EBR"],
"Erzgebirge Aue": ["Erzgebirge Aue", "Erzgebirge", "Aue", "AUE"],
"FC Ingolstadt": ["FC Ingolstadt", "Ingolstadt", "FCI"],
"Fortuna Duesseldorf": ["Fortuna Duesseldorf", "Fortuna", "Duesseldorf", "DU"],
"Greuther Fuerth": ["Greuther Fuerth", "Greuther", "Fuerth", "GRF"],
"Heidenheim": ["Heidenheim", "HEI"],
"Holstein Kiel": ["Holstein Kiel", "Holstein", "Kiel", "HKI"],
"Jahn Regensburg": ["Jahn Regensburg", "Regensburg", "JAH"],
"Kaiserslautern": ["Kaiserslautern", "FCK"],
"MSV Duisburg": ["MSV Duisburg", "MSV", "Duisburg"],
"Nuremberg": ["Nuremberg", "NUR"],
"Sandhausen": ["Sandhausen", "SAN"],
"St Pauli": ["St Pauli", "PAU", "Pauli"],
"Union Berlin": ["Union Berlin", "Berlin", "UNB"],
"VfL Bochum": ["VfL Bochum", "Bochum", "BOC"],
"Borussia Dortmund": ["Borussia Dortmund", "Borussia", "Dortmund", "DOR", "DORT"],
"Argentinos Juniors": ["Argentinos Juniors", "Argentinos", "Juniors", "ARJ"],
"Atletico Tucuman": ["Atletico Tucuman", "Atletico", "Tucuman", "ATU"],
"Banfield": ["Banfield", "BAN"],
"Belgrano": ["Belgrano", "BEL"],
"Boca Juniors": ["Boca Juniors", "Juniors", "BOJ"],
"Chacarita Juniors": ["Chacarita Juniors", "Juniors", "CHJ"],
"Colon": ["Colon", "COO"],
"Defensa y Justicia": ["Defensa y Justicia", "Defensa", "Justicia", "DEF"],
"Estudiantes": ["Estudiantes", "ESU"],
"Gimnasia La Plata": ["Gimnasia La Plata", "Gimnasia", "La Plata", "GIM"],
"Godoy Cruz": ["Godoy Cruz", "Godoy", "Cruz", "GOD"],
"Huracan": ["Huracan", "HUR"],
"Independiente": ["Independiente", "IND"],
"Lanus": ["Lanus", "LAN"],
"Newell's Old Boys": ["Newell's Old Boys", "Newell's", "NOB"],
"Olimpo": ["Olimpo", "OLI"],
"Patronato": ["Patronato", "PTO"],
"Racing Club": ["Racing Club", "Racing", "RAC"],
"River Plate": ["River Plate", "Plate", "RIV"],
"Rosario Central": ["Rosario Central", "Rosario", "Central", "ROS"],
"San Lorenzo": ["San Lorenzo", "San", "Lorenzo", "SLO"],
"San Martin de San Juan": ["San Martin de San Juan", "San Martin", "San Juan", "SMS"],
"Talleres Cordoba": ["Talleres Cordoba", "Talleres", "Cordoba", "TAL"],
"Temperley": ["Temperley", "TEM"],
"Tigre": ["Tigre", "TIG"],
"Union Santa Fe": ["Union Santa Fe", "Union Santa", "USF"],
"Velez Sarsfield": ["Velez Sarsfield", "Sarsfield", "Velez", "VEL"],
"Admira": ["Admira", "ADM"],
"Austria Vienna": ["Austria Vienna", "Austria", "Vienna", "VIE"],
"LASK Linz": ["LASK Linz", "LASK", "Linz", "LIN"],
"Mattersburg": ["Mattersburg", "MAT"],
"Rapid Vienna": ["Rapid Vienna", "Rapid", "Vienna", "RAV"],
"Red Bull Salzburg": ["Red Bull", "Red Bull Salzburg", "RBS", "Salzburg"],
"Rheindorf Altach": ["Rheindorf Altach", "Rheindorf", "Altach", "RAL"],
"St Polten": ["St Polten", "Polten", "STP"],
"Sturm Graz": ["Sturm Graz", "Sturm", "Graz", "SGR"],
"Wolfsberger AC": ["Wolfsberger AC", "Wolfsberger", "WOL"],
"Anderlecht": ["Anderlecht", "ADL"],
"AS Eupen": ["AS Eupen", "Eupen", "ASE"],
"Club Brugge": ["Club Brugge", "Club", "Brugge"],
"Afghanistan": ["AFG", "Afghanistan"],
"Albania": ["ALB", "Albania"],
"Algeria": ["DZA", "Algeria"],
Expand Down
15 changes: 14 additions & 1 deletion functions/dataFormat.js
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,18 @@ function quickReplyFormat(payloadCharacteristic, value) {
return finalArr;
}

function teamDataQuick(payloadCharacteristic, value, teamName) {
let finalArr = [];
for (var i = 0; i < value.length; i++) {
var map = {};
map['content_type'] = 'text';
map['title'] = value[i];
map['payload'] = payloadCharacteristic + value[i] + '_' + teamName;
finalArr.push(map);
}
return finalArr;
}

function teamOptionFormat(payloadCharacteristic, choices, teamName) {
let finalArr = [];
for (var i = 0; i < choices.length; i++) {
Expand All @@ -126,6 +138,7 @@ module.exports = {
timeFormat,
teamFormat,
quickReplyFormat,
teamDataQuick,
teamOptionFormat,
decodeUnderline
}
}
13 changes: 11 additions & 2 deletions functions/handleCases.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,18 @@ function getStart(sender_psid) {

// Provides four options: Next Match, Team News, Team Squad, Next 5 games
function teamOptions(sender_psid, teamName, imageURL) {
let choices = ['Next Match', 'Team News', 'Another Team'];
let choices = ['Next Match', 'Team Data', 'Another Team'];
sendResponse.teamOptionChoose(sender_psid, teamName, 'OPTION', choices, imageURL);
}

function teamData(sender_psid, teamName) {
let choices = ['Team News', 'Team Squad', 'Team Schedules', 'Lastest Video', 'Go Back'];
let response = {
'text': `Please select the option of data you want`
}
sendResponse.quickDataAccess(sender_psid, teamName ,response, "TEAMDATA", choices);
}

// Provides 11 popular team options
function popularTeam(sender_psid) {
let key = ['Manchester United', 'Real Madrid', 'Barcelona', 'Chelsea', 'Manchester City', 'Paris Saint Germain', 'Arsenal', 'Liverpool', 'Germany', 'Brazil', 'Spain'];
Expand Down Expand Up @@ -68,8 +76,9 @@ function setReminder(sender_psid, match) {
module.exports = {
getStart,
teamOptions,
teamData,
popularTeam,
popularPlayer,
getContinue,
setReminder
}
}
Loading