Public
HTTP (deprecated)
Val Town is a social website to write and deploy JavaScript.
Build APIs and schedule functions from your browser.
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
import { blob } from "https://esm.town/v/std/blob";
import axios from "npm:axios";
/* cookies manager class */
class Cookies {
/* constructor */
constructor(cookiesString) {
this.cookiesString = cookiesString.trim();
this.cookiesObject = this.convertCookiesStringToObject();
}
/* string representation of this cookies class */
toString() {
return this.cookiesString;
}
/* object representation of thie cookies class */
toObject() {
return this.cookiesObject;
}
/* setting the whole cookies object from a string */
set(cookiesString) {
this.cookiesString = cookiesString.trim();
this.cookiesObject = this.convertCookiesStringToObject();
}
/* getting the whole cookies object */
get() {
return this.cookiesString;
}
/* converting the string cookies to object */
convertCookiesStringToObject() {
var resultCookiesObject = {};
if (this.cookiesString.length > 1) {
var splittedCookies = this.cookiesString.split(";");
for (var cookieString of splittedCookies) {
var cookieCouple = cookieString.trim().split("=");
resultCookiesObject[cookieCouple[0]] = cookieCouple[1];
}
}
return resultCookiesObject;
}
/* converting the cookies object to string */
convertCookiesObjectToString() {
var cookiesArray = [];
for (var cookie in this.cookiesObject)
cookiesArray.push(`${cookie}=${this.cookiesObject[cookie]}`);
return cookiesArray.join(";");
}
/* adding or updating cookie value */
setCookie(cookieName, cookieValue) {
this.cookiesObject[cookieName] = cookieValue;
this.cookiesString = this.convertCookiesObjectToString();
}
/* getting cookie value */
getCookie(cookieName) {
return this.cookiesObject[cookieName];
}
}
/* bet session */
class BetSession {
/* constructor */
constructor(platform, cookies) {
// platform and authentication details
this.platform = platform;
this.cookies = new Cookies(cookies);
// initial data
this.initialBetAmount = undefined;
this.initialMultiplier = undefined;
// variable data
this.currentBetAmount = undefined;
this.currentMultiplier = undefined;
this.currentOption = undefined;
this.currentBalance = undefined;
this.currentProfit = 0;
// bet and streak counter
this.count = 0;
this.winStreak = 0;
this.lossStreak = 0;
// event handlers container
this.winHandlers = [];
this.lossHandlers = [];
this.betHandlers = [];
this.streakOfWinHandlers = [];
this.streakOfLossHandlers = [];
// running auto bet
this.isRunning = false;
}
cyrilos-litepickbet.web.val.run
August 22, 2024