1
1
'use strict' ;
2
2
3
3
var XMLHttpRequest = require ( "xmlhttprequest" ) . XMLHttpRequest ;
4
- var url = 'http://0 .0.0.0 :5000/' ;
4
+ var url = 'http://127 .0.0.1 :5000/' ;
5
5
6
6
module . exports = ( bot ) => {
7
7
@@ -39,22 +39,31 @@ module.exports = (bot) => {
39
39
40
40
const subscriptionCategories = ( convo ) => {
41
41
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 })
47
54
48
- convo . say ( 'Our current categories are: ' , { typing :true } )
49
- . then ( ( ) => {
50
- convo . say ( categoriesMessage ) ;
51
- } ) ;
55
+ convo . ask ( doNothing , ( payload , convo ) => {
52
56
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"
54
66
55
- convo . ask ( doNothing , ( payload , convo ) => {
56
- const categoryNames = payload . message . text ;
57
- const updatedCategoryNames = categoryNames . toLowerCase ( ) . replace ( / \s / g, '' ) ;
58
67
convo . set ( 'categoryNames' , updatedCategoryNames ) ;
59
68
60
69
addSubscriptionsToFlask ( convo ) ;
@@ -66,7 +75,7 @@ module.exports = (bot) => {
66
75
const userID = payload . sender . id ;
67
76
chat . conversation ( ( convo ) => {
68
77
convo . set ( 'userID' , userID ) ;
69
- subscriptionCategories ( convo ) ;
78
+ addSubscriptionsToFlask ( convo ) ;
70
79
return ;
71
80
} ) ;
72
81
} ) ;
@@ -78,6 +87,7 @@ module.exports = (bot) => {
78
87
const removeSubscriptionsFromFlask = ( convo ) => {
79
88
80
89
var userid = convo . get ( 'userID' ) ;
90
+ var params = { "userid" : userid } ;
81
91
var categoryNames = convo . get ( 'categoryNames' ) ;
82
92
var params = { "userid" : userid , "categoryNames" : categoryNames } ;
83
93
console . log ( JSON . stringify ( params ) ) ;
@@ -101,22 +111,31 @@ module.exports = (bot) => {
101
111
102
112
const unsubscriptionCategories = ( convo ) => {
103
113
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
+ // });
109
124
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 })
116
126
117
127
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
+
120
139
convo . set ( 'categoryNames' , updatedCategoryNames ) ;
121
140
122
141
removeSubscriptionsFromFlask ( convo ) ;
@@ -128,7 +147,7 @@ module.exports = (bot) => {
128
147
const userID = payload . sender . id ;
129
148
chat . conversation ( ( convo ) => {
130
149
convo . set ( 'userID' , userID ) ;
131
- unsubscriptionCategories ( convo ) ;
150
+ removeSubscriptionsFromFlask ( convo ) ;
132
151
return ;
133
152
} ) ;
134
153
} ) ;
0 commit comments