Skip to content

Commit 01b719c

Browse files
author
arantzardzm
committed
removed telegram and updated facebook bot
1 parent e4651d6 commit 01b719c

File tree

12 files changed

+80
-711
lines changed

12 files changed

+80
-711
lines changed

bot/facebook/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ const BootBot = require('bootbot');
44
const config = require('config');
55
const schedule = require('node-schedule');
66
var XMLHttpRequest = require("xmlhttprequest").XMLHttpRequest;
7-
var url = 'http://0.0.0.0:5000/';
7+
var url = 'http://127.0.0.1:5000/';
88

99
var TurndownService = require('turndown');
1010
var turndownService = new TurndownService();

bot/facebook/modules/spammer.js

Lines changed: 48 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
'use strict';
22

33
var XMLHttpRequest = require("xmlhttprequest").XMLHttpRequest;
4-
var url = 'http://0.0.0.0:5000/';
4+
var url = 'http://127.0.0.1:5000/';
55

66
module.exports = (bot) => {
77

@@ -39,22 +39,31 @@ module.exports = (bot) => {
3939

4040
const subscriptionCategories = (convo) => {
4141

42-
var categoriesMessage = 'Academics' + '\n' + 'Intercultural Affairs' + '\n' + 'Events and Activities' + '\n' + 'Student Activities' + '\n' +
43-
'Dining' + '\n' + 'Community Outreach' + '\n' +'Fitness Center' + '\n' + 'Research' + '\n' + 'Campus Life' + '\n' + 'Athletics' + '\n' +
44-
'Registrar' + '\n' + 'Community Life' + '\n' + 'Career Development' + '\n' + 'Academic Affairs' + '\n' + 'Spiritual Life' + '\n' +
45-
'Library' + '\n' + 'Finance' + '\n' + 'Residential Education' + '\n' + 'Global Education' + '\n' + 'Facilities' + '\n' + 'Health and Wellness' + '\n' +
46-
'Housing' + '\n' + 'Public Safety' + '\n' + 'Transportation' + '\n' + 'First-Year Office';
42+
// var categoriesMessage = 'Academics' + '\n' + 'Intercultural Affairs' + '\n' + 'Events and Activities' + '\n' + 'Student Activities' + '\n' +
43+
// 'Dining' + '\n' + 'Community Outreach' + '\n' +'Fitness Center' + '\n' + 'Research' + '\n' + 'Campus Life' + '\n' + 'Athletics' + '\n' +
44+
// 'Registrar' + '\n' + 'Community Life' + '\n' + 'Career Development' + '\n' + 'Academic Affairs' + '\n' + 'Spiritual Life' + '\n' +
45+
// 'Library' + '\n' + 'Finance' + '\n' + 'Residential Education' + '\n' + 'Global Education' + '\n' + 'Facilities' + '\n' + 'Health and Wellness' + '\n' +
46+
// 'Housing' + '\n' + 'Public Safety' + '\n' + 'Transportation' + '\n' + 'First-Year Office';
47+
//
48+
// convo.say('Our current categories are: ', { typing:true })
49+
// .then(() => {
50+
// convo.say(categoriesMessage);
51+
// });
52+
//
53+
// convo.say('Type all the names of the categories you wish to be subscribed to separated by commas. (ex. academics, facilities, health and wellness).', { typing: true })
4754

48-
convo.say('Our current categories are: ', { typing:true })
49-
.then(() => {
50-
convo.say(categoriesMessage);
51-
});
55+
convo.ask(doNothing, (payload, convo) => {
5256

53-
convo.say('Type all the names of the categories you wish to be subscribed to separated by commas. (ex. Academics, Facilities, Health and Wellness).', { typing: true })
57+
//const categoryNames = payload.message.text;
58+
//const updatedCategoryNames = categoryNames.toLowerCase().replace(/\s/g, '');
59+
60+
const updatedCategoryNames = "academics,academicaffairs,academicresourcecenter,globaleducation,library," +
61+
"mentoring,registrar,admissions,campuslife,athletics,careerdevelopment,communityoutreach,first-yearoffice," +
62+
"fitnesscenter,interculturalaffairs,residentialeducation,spirituallife,studentactivities,aroundabudhabi," +
63+
"eventsandactivities,grants,nyuadservices,bookstore,communications,communitylife,environmentalhealthandsafety," +
64+
"dining,facilities,finance,healthandwellness,housing,humanresources,mail,publicsafety,technology,transportation," +
65+
"travel,operations,research,studentsabroad"
5466

55-
convo.ask(doNothing, (payload, convo) => {
56-
const categoryNames = payload.message.text;
57-
const updatedCategoryNames = categoryNames.toLowerCase().replace(/\s/g, '');
5867
convo.set('categoryNames', updatedCategoryNames);
5968

6069
addSubscriptionsToFlask(convo);
@@ -66,7 +75,7 @@ module.exports = (bot) => {
6675
const userID = payload.sender.id;
6776
chat.conversation((convo) => {
6877
convo.set('userID', userID);
69-
subscriptionCategories(convo);
78+
addSubscriptionsToFlask(convo);
7079
return;
7180
});
7281
});
@@ -78,6 +87,7 @@ module.exports = (bot) => {
7887
const removeSubscriptionsFromFlask = (convo) => {
7988

8089
var userid = convo.get('userID');
90+
var params = {"userid": userid};
8191
var categoryNames = convo.get('categoryNames');
8292
var params = {"userid": userid, "categoryNames": categoryNames};
8393
console.log(JSON.stringify(params));
@@ -101,22 +111,31 @@ module.exports = (bot) => {
101111

102112
const unsubscriptionCategories = (convo) => {
103113

104-
var categoriesMessage = 'Academics' + '\n' + 'Intercultural Affairs' + '\n' + 'Events and Activities' + '\n' + 'Student Activities' + '\n' +
105-
'Dining' + '\n' + 'Community Outreach' + '\n' +'Fitness Center' + '\n' + 'Research' + '\n' + 'Campus Life' + '\n' + 'Athletics' + '\n' +
106-
'Registrar' + '\n' + 'Community Life' + '\n' + 'Career Development' + '\n' + 'Academic Affairs' + '\n' + 'Spiritual Life' + '\n' +
107-
'Library' + '\n' + 'Finance' + '\n' + 'Residential Education' + '\n' + 'Global Education' + '\n' + 'Facilities' + '\n' + 'Health and Wellness' + '\n' +
108-
'Housing' + '\n' + 'Public Safety' + '\n' + 'Transportation' + '\n' + 'First-Year Office';
114+
// var categoriesMessage = 'Academics' + '\n' + 'Intercultural Affairs' + '\n' + 'Events and Activities' + '\n' + 'Student Activities' + '\n' +
115+
// 'Dining' + '\n' + 'Community Outreach' + '\n' +'Fitness Center' + '\n' + 'Research' + '\n' + 'Campus Life' + '\n' + 'Athletics' + '\n' +
116+
// 'Registrar' + '\n' + 'Community Life' + '\n' + 'Career Development' + '\n' + 'Academic Affairs' + '\n' + 'Spiritual Life' + '\n' +
117+
// 'Library' + '\n' + 'Finance' + '\n' + 'Residential Education' + '\n' + 'Global Education' + '\n' + 'Facilities' + '\n' + 'Health and Wellness' + '\n' +
118+
// 'Housing' + '\n' + 'Public Safety' + '\n' + 'Transportation' + '\n' + 'First-Year Office';
119+
//
120+
// convo.say('Our current categories are: ', { typing:true })
121+
// .then(() => {
122+
// convo.say(categoriesMessage);
123+
// });
109124

110-
convo.say('Our current categories are: ', { typing:true })
111-
.then(() => {
112-
convo.say(categoriesMessage);
113-
});
114-
115-
convo.say('Type all the names of the categories you wish to be unsubscribed from separated by commas. (ex. Academics, Facilities, Health and Wellness).', { typing: true })
125+
//convo.say('Type all the names of the categories you wish to be unsubscribed from separated by commas. (ex. Academics, Facilities, Health and Wellness).', { typing: true })
116126

117127
convo.ask(doNothing, (payload, convo) => {
118-
const categoryNames = payload.message.text;
119-
const updatedCategoryNames = categoryNames.toLowerCase().replace(/\s/g, '');
128+
129+
//const categoryNames = payload.message.text;
130+
//const updatedCategoryNames = categoryNames.toLowerCase().replace(/\s/g, '');
131+
132+
const updatedCategoryNames = "academics,academicaffairs,academicresourcecenter,globaleducation,library," +
133+
"mentoring,registrar,admissions,campuslife,athletics,careerdevelopment,communityoutreach,first-yearoffice," +
134+
"fitnesscenter,interculturalaffairs,residentialeducation,spirituallife,studentactivities,aroundabudhabi," +
135+
"eventsandactivities,grants,nyuadservices,bookstore,communications,communitylife,environmentalhealthandsafety," +
136+
"dining,facilities,finance,healthandwellness,housing,humanresources,mail,publicsafety,technology,transportation," +
137+
"travel,operations,research,studentsabroad"
138+
120139
convo.set('categoryNames', updatedCategoryNames);
121140

122141
removeSubscriptionsFromFlask(convo);
@@ -128,7 +147,7 @@ module.exports = (bot) => {
128147
const userID = payload.sender.id;
129148
chat.conversation((convo) => {
130149
convo.set('userID', userID);
131-
unsubscriptionCategories(convo);
150+
removeSubscriptionsFromFlask(convo);
132151
return;
133152
});
134153
});

bot/facebook/package-lock.json

Lines changed: 29 additions & 17 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

bot/facebook/package.json

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -34,21 +34,13 @@
3434
"resolved": "https://registry.npmjs.org/body-parser/-/body-parser-1.18.2.tgz",
3535
"version": "1.18.2"
3636
},
37-
"bootbot": "^1.0.14",
37+
"bootbot": "^1.0.16",
3838
"bytes": {
3939
"integrity": "sha1-0ygVQE1olpn4Wk6k+odV3ROpYEg=",
4040
"resolved": "https://registry.npmjs.org/bytes/-/bytes-3.0.0.tgz",
4141
"version": "3.0.0"
4242
},
43-
"config": {
44-
"integrity": "sha1-HWCp81NIoTwXV5jThOgaWhbDum4=",
45-
"requires": {
46-
"json5": "0.4.0",
47-
"os-homedir": "1.0.2"
48-
},
49-
"resolved": "https://registry.npmjs.org/config/-/config-1.30.0.tgz",
50-
"version": "1.30.0"
51-
},
43+
"config": "^2.0.1",
5244
"content-disposition": {
5345
"integrity": "sha1-DPaLud318r55YcOoUXjLhdunjLQ=",
5446
"resolved": "https://registry.npmjs.org/content-disposition/-/content-disposition-0.5.2.tgz",

bot/telegram/config/default.example.json

Lines changed: 0 additions & 4 deletions
This file was deleted.

bot/telegram/index.js

Lines changed: 0 additions & 21 deletions
This file was deleted.

0 commit comments

Comments
 (0)