Repository navigation
Expand file tree
/
Copy pathchat.js
More file actions
236 lines (176 loc) · 8.2 KB
/
Copy pathchat.js
File metadata and controls
236 lines (176 loc) · 8.2 KB
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
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
// KEYWORD BANK
const HELLO = ["HI", "HEY", "SUP", "HELLO", "BONJOUR"]
const GOODBYE = ["BYE", "SEE YOU LATER", "GOTTA GO", "ADIOS", "SAYONARA", "BBIE", "BIE"]
const GREETINGS = ["WHATS UP", "HOW ARE YOU", "MORNING", "AFTERNOON", "EVENING", "SLEEP", "GOOD"];
const NAME = ["WHO ARE YOU", "CODED", "PROGRAMMED","YOUR NAME"]
const HOW = ["HOW", "WORK", "PLAN"]
const WHAT = ["WHAT", "WHATS", "IS VOTERFLUX"]
const BRUH = ["BRUH"]
//bot bruh words
// onclick submit function
$("#submit").click(function(){
//get message
var message = document.getElementById("message").value;
console.log(message);
//show message
var para = document.createElement("p");
var text = document.createTextNode(message);
para.className = "userMsg";
para.appendChild(text);
var invitext = document.getElementById("invitext");
invitext.append(para);
//interpret the message
var message = message.toUpperCase();
/* if(message.includes(HELLO)){
console.log("bruh yes")
} */
var bro = message.replace(" ", ";");
var words = bro.split(";");
function findCommonElementhello(array1, array2) {
// Loop for array1
for(let i = 0; i < array1.length; i++) {
// Loop for array2
for(let j = 0; j < array2.length; j++) {
// Compare the element of each and
// every element from both of the
// arrays
if(array1[i] === array2[j]) {
// Return if common element found
var para = document.createElement("p");
var text = document.createTextNode("Hi there!");
para.className = "bottext";
para.appendChild(text);
var invitext = document.getElementById("invitext");
invitext.append(para);
}
}
} //CHAMAN IT WORKS NOW!!:) yayayayaayaya :)
}
function findCommonElementbye(array1, array2) {
// Loop for array1
for(let i = 0; i < array1.length; i++) {
// Loop for array2
for(let j = 0; j < array2.length; j++) {
// Compare the element of each and
// every element from both of the
// arrays
if(array1[i] === array2[j]) {
// Return if common element found
var para = document.createElement("p");
var text = document.createTextNode("Bbie then...");
para.className = "bottext";
para.appendChild(text);
var invitext = document.getElementById("invitext");
invitext.append(para);
}
}
} //CHAMAN IT WORKS NOW!!:)
}
function findCommonElementgreet(array1, array2) {
// Loop for array1
for(let i = 0; i < array1.length; i++) {
// Loop for array2
for(let j = 0; j < array2.length; j++) {
// Compare the element of each and
// every element from both of the
// arrays
if(array1[i] === array2[j]) {
// Return if common element found
var para = document.createElement("p");
var text = document.createTextNode("I barely got made in time but i nice :)");
para.className = "bottext";
para.appendChild(text);
var invitext = document.getElementById("invitext");
invitext.append(para);
}
}
} //CHAMAN IT WORKS NOW!!:)
}
function findCommonElementname(array1, array2) {
// Loop for array1
for(let i = 0; i < array1.length; i++) {
// Loop for array2
for(let j = 0; j < array2.length; j++) {
// Compare the element of each and
// every element from both of the
// arrays
if(array1[i] === array2[j]) {
// Return if common element found
var para = document.createElement("p");
var text = document.createTextNode("I am the Voterflux bot! Programmed with <3 by Hanuman :)");
para.className = "bottext";
para.appendChild(text);
var invitext = document.getElementById("invitext");
invitext.append(para);
}
}
} //CHAMAN IT WORKS NOW!!:)
}
function findCommonElementhow(array1, array2) {
// Loop for array1
for(let i = 0; i < array1.length; i++) {
// Loop for array2
for(let j = 0; j < array2.length; j++) {
// Compare the element of each and
// every element from both of the
// arrays
if(array1[i] === array2[j]) {
// Return if common element found
var para = document.createElement("p");
var text = document.createTextNode("The technology behind VoterFlux relies on the power lines reaching the farthest corners of our nation. Electricity is a utility we can proudly say, every American has access to. So in such a scenario, why not use the most valuable asset we have which connects our country's furthest corners");
para.className = "bottext";
para.appendChild(text);
var invitext = document.getElementById("invitext");
invitext.append(para);
}
}
} //CHAMAN IT WORKS NOW!!:)
}
function findCommonElementwhat(array1, array2) {
// Loop for array1
for(let i = 0; i < array1.length; i++) {
// Loop for array2
for(let j = 0; j < array2.length; j++) {
// Compare the element of each and
// every element from both of the
// arrays
if(array1[i] === array2[j]) {
// Return if common element found
var para = document.createElement("p");
var text = document.createTextNode("VoterFlux is an innovative alternate solution to in-person voting and mail-in ballots. In the light of the drastically changed unprecedented conditions due to this pandemic, we present to you an easy alternate to the stated problem.");
para.className = "bottext";
para.appendChild(text);
var invitext = document.getElementById("invitext");
invitext.append(para);
}
}
} //CHAMAN IT WORKS NOW!!:)
}
function findCommonElementbruh(array1, array2) {
// Loop for array1
for(let i = 0; i < array1.length; i++) {
// Loop for array2
for(let j = 0; j < array2.length; j++) {
// Compare the element of each and
// every element from both of the
// arrays
if(array1[i] === array2[j]) {
// Return if common element found
var para = document.createElement("p");
var text = document.createTextNode("/bruh.jpg");
para.className = "bottext";
para.appendChild(text);
var invitext = document.getElementById("invitext");
invitext.append(para);
}
}
} //CHAMAN IT WORKS NOW!!:)
}
findCommonElementhello(words, HELLO);
findCommonElementbye(words, GOODBYE);
findCommonElementgreet(words, GREETINGS);
findCommonElementname(words, NAME);
findCommonElementhow(words, HOW);
findCommonElementhow(words, WHAT);
findCommonElementbruh(words, BRUH);
})