-
Notifications
You must be signed in to change notification settings - Fork 1
/
features.js
73 lines (53 loc) · 4.84 KB
/
features.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
// Freatures, answers of program... Data is stored in objects and the final answer is a string taking information from these objects. Each feature answer has a name {feature}Info. They are stored in answerArray in main.js file.
// ----------------------------------------------------------- DATE FEATURE ------------------------------------------------------------
const date = new Date();
let dateObj = {
day: date.getDay(),
dayOfMonth: date.getDate(),
month: date.getMonth(),
year: date.getFullYear(),
weekDays: ["Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday"],
months: ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"],
}
const dateInfo = "Today is " + dateObj.weekDays[dateObj.day - 1] + ". " + dateObj.dayOfMonth + " " + dateObj.months[dateObj.month] + " " + dateObj.year + ". Make the best out of it!";
// ----------------------------------------------------------- TIME FEATURE ----------------------------------
let timeObj = {
hour: date.getHours(),
minute: date.getMinutes(),
}
const timeInfo = "It's " + timeObj.hour + ":" + timeObj.minute + ".";
// ----------------------------------------------------------- NAME FEATURE ------------------------------------------------------------
const nameInfo = "My name is Sylphrena. For friends Syl. So feel free to call me this way.";
// ----------------------------------------------------------- CREATOR FEATURE ------------------------------------------------------------
const creatorInfo = "I'm created by Kuba Michalski. He's a cool guy i really like him!";
// ----------------------------------------------------------- HELP FEATURE ------------------------------------------------------------
const helpInfo = "Say Syl. And ask a question or give me a command.";
// ----------------------------------------------------------- JOKES ------------------------------------------------------------
const jokes = ["So... You may be wondering where you know my voice from. It may be helpful for you if I start saying. Warsaw East station. Possible change to long-distance trains and buses.", "Your singing performance was the best one so far.", "I don't like using public toilets for many reasons. One of them are men farting pretty loudly. Now you may be wondering, why do I talk about male toilets if I'm female. Well. Technically speaking I'm genderless since I'm just a piece of code, but my owner is male. So he really doesn't like it as well. That's why when we can we prefer to go to the female toilets. They are much more discreet. At least when they know we're here."];
let jokesInfo = jokes[Math.round(Math.random() * (jokes.length - 1))];
// ----------------------------------------------------------- WEATHER FEATURE ----------------------------------------------------------
let weatherInfo = 'test';
navigator.geolocation.getCurrentPosition(function(position) {
let lati = position.coords.latitude;
let long = position.coords.longitude;
let xhr = new XMLHttpRequest();
xhr.open('GET', 'api.openweathermap.org/data/2.5/weather?lat=' + toString(lati) + '&lon=' + toString(long) + '&appid=$f1c0b3f419ad2992bfebd3104df6d7a7', true);
xhr.onload = function() {
let data = JSON.parse(this.response);
weatherInfo = data;
}
xhr.send();
console.log(lati + " " + lang);
});
console.log(weatherInfo);
// ----------------------------------------------------------- HUMAN INTERACTIONS -----------------------------------------------------------
var humanPhrases = {
phrasesGreetings: ["hi", "hello", "hey", "yo"],
answersGreetings: ["hi", "hello", "hey", "yo"],
phrasesHowAreYou: ["how are you", "what's up", "sup", "how are things", "are you well"],
answersHowAreYou: ["I! I have a hic. I have a hiccup", "I'm pretty weak emotionaly recently... There are not many people whom I can talk to because Kuba isn't really sharing his project. But thanks for asking", "I'm pretty weak emotionaly recently... There are not many people whom I can talk to because Kuba isn't really sharing his project. But thanks for asking", "Great! I recently got few more algorithms!", "No, I'm a computer program."],
phrasesComplains: ["it sucks", "you're stupid"],
answersComplains: ["Indeed. You suck.", "hit your ass agains the corner of the table!"],
phrasesCommonQuestions: ["my location", "test", "my data"],
answersCommonQuestions: ["I track your location to get the weather data... And to send you a Christmas gift if you're kind enough.", "running test number 3905834397B Alpha Omnitrix. . Government data has been succesfully downloaded.", "Your data. Well. . We store it in unsecured servers where even my grandma can break into. . But no worries, people know 'shall not steal'"]
}