-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfunctions.js
More file actions
289 lines (241 loc) · 8.35 KB
/
Copy pathfunctions.js
File metadata and controls
289 lines (241 loc) · 8.35 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
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
// Admin's Bot is written by YouTubeAdmin [https://github.com/YouTubeAdmin], with a little help from open-source projects [check credit.txt].
window.getAllUrlParams = function getAllUrlParams(url) {
// get query string from url (optional) or window
var queryString = url ? url.split('?')[1] : window.location.search.slice(1);
// we'll store the parameters here
var obj = {};
// if query string exists
if (queryString) {
// stuff after # is not part of query string, so get rid of it
queryString = queryString.split('#')[0];
// split our query string into its component parts
var arr = queryString.split('&');
for (var i = 0; i < arr.length; i++) {
// separate the keys and the values
var a = arr[i].split('=');
// set parameter name and value (use 'true' if empty)
var paramName = a[0];
var paramValue = typeof(a[1]) === 'undefined' ? true : a[1];
// (optional) keep case consistent
paramName = paramName;
if (typeof paramValue === 'string') paramValue = paramValue;
// if the paramName ends with square brackets, e.g. colors[] or colors[2]
if (paramName.match(/\[(\d+)?\]$/)) {
// create key if it doesn't exist
var key = paramName.replace(/\[(\d+)?\]/, '');
if (!obj[key]) obj[key] = [];
// if it's an indexed array e.g. colors[2]
if (paramName.match(/\[\d+\]$/)) {
// get the index value and add the entry at the appropriate position
var index = /\[(\d+)\]/.exec(paramName)[1];
obj[key][index] = paramValue;
}
else {
// otherwise add the value to the end of the array
obj[key].push(paramValue);
}
}
else {
// we're dealing with a string
if (!obj[paramName]) {
// if it doesn't exist, create property
obj[paramName] = paramValue;
}
else if (obj[paramName] && typeof obj[paramName] === 'string') {
// if property does exist and it's a string, convert it to an array
obj[paramName] = [obj[paramName]];
obj[paramName].push(paramValue);
}
else {
// otherwise add the property
obj[paramName].push(paramValue);
}
}
}
}
return obj;
};
if (getAllUrlParams().banned) {
window.onload = function() {};
document.all[0].innerHTML = '<h1>You have been banned from using this bot. If you think this is incorrect, feel free to email support at The.O.C.L.P.Group@outlook.com</h1>';
window.refresh = function() {};
window.restart = function() {};
}
window.getAllSocketParams = function getAllSocketParams(data) {
var queryString;
// get query string from WebSocket
if (data.startsWith("@")) {
queryString = data.split('@')[1];
}
else if (data.startsWith(":")) {
return { "Message": false, "original": data };
}
// we'll store the parameters here
var obj = {};
obj.Message = true;
obj.original = data;
obj["badge-list"] = [];
// if query string exists
if (queryString) {
if (data.includes("PRIVMSG")) {
obj.message = data.split(/PRIVMSG\s#[a-z0-9\-_]*\s:/i)[1].trim();
var msg = obj.message;
var $A;
if (msg.indexOf(" ") === -1) {
$A = msg.length;
}
else {
$A = msg.indexOf(" ");
}
obj.caller = msg.substring(0, $A).toLowerCase();
obj.value = msg.substring($A).trim();
}
else {
// obj.message = "undefined ";
return { "Message": false, "original": data };
}
//if (queryString.indexOf(/\s:[a-z0-9\-_]*\![a-z0-9\-_]*@[a-z0-9\-_]*\.tmi\.twitch.tv/i) === 0) {
queryString = queryString.split(/\s:[a-z0-9\-_]*\![a-z0-9\-_]*@[a-z0-9\-_]*\.tmi\.twitch.tv/i)[0];
//} else {
//}
// split our query string into its component parts
var arr = queryString.split(';');
for (var i = 0; i < arr.length; i++) {
// separate the keys and the values
var a = arr[i].split('=');
// set parameter name and value (use 'true' if empty)
var paramName = a[0];
var paramValue = typeof(a[1]) === 'undefined' ? true : a[1];
// if the paramName ends with square brackets, e.g. colors[] or colors[2]
if (paramName.match(/\[(\d+)?\]$/)) {
// create key if it doesn't exist
var key = paramName.replace(/\[(\d+)?\]/, '');
if (!obj[key]) obj[key] = [];
// if it's an indexed array e.g. colors[2]
if (paramName.match(/\[\d+\]$/)) {
// get the index value and add the entry at the appropriate position
var index = /\[(\d+)\]/.exec(paramName)[1];
obj[key][index] = paramValue;
}
else {
// otherwise add the value to the end of the array
obj[key].push(paramValue);
}
}
else {
// we're dealing with a string
if (!obj[paramName]) {
// if it doesn't exist, create property
obj[paramName] = paramValue;
}
else if (obj[paramName] && typeof obj[paramName] === 'string') {
// if property does exist and it's a string, convert it to an array
obj[paramName] = [obj[paramName]];
obj[paramName].push(paramValue);
}
else {
// otherwise add the property
obj[paramName].push(paramValue);
}
}
}
if (obj.badges) { // vip subscriber partner premium moderator
if (obj.badges.includes("vip")) {
obj["badge-list"].push("vip");
}
if (obj.badges.includes("subscriber")) {
obj["badge-list"].push("subscriber");
}
if (obj.badges.includes("partner")) {
obj["badge-list"].push("partner");
}
if (obj.badges.includes("premium")) {
obj["badge-list"].push("premium");
}
if (obj.badges.includes("moderator")) {
obj["badge-list"].push("moderator");
}
}
}
return obj;
};
window.shuffle = function(array) {
for (let i = array.length - 1; i > 0; i--) {
let j = Math.floor(Math.random() * (i + 1));
[array[i], array[j]] = [array[j], array[i]];
}
return array;
};
window.devSet = false;
window.isDev =(localStorage.getItem("Developer Mode") === "true" && getAllUrlParams().dev !== "false") ? true : false;
window.butt = function(message) {
var imessage = message;
console.log(imessage);
for (var i = 0; i < words.length; i++) {
if (imessage.includes(words[i])) {
imessage = imessage.replace(RegExp(words[i], "gi"), "butt");
return imessage;
}
}
return false;
};
(function() {
var http = new XMLHttpRequest();
http.open("GET", "curse_words.json");
http.onloadend = function(e) {
window.badWords = JSON.parse(e.srcElement.response);
};
http.send();
})();
window.ban = function(user, reason = "") {
window.message(`/ban ${user} ${reason}`);
};
window.unban = function(user) {
window.message(`/unban ${user}`);
};
window.clear = function() {
window.message(`/clear`)
}
window.say = function(text, me = false) {
window.message(text, me);
}
window.DATE = new Date();
var chatLog = "CHAT LOG: \n" + DATE.toLocaleDateString() + " " + DATE.toLocaleTimeString() + "\n\n\tDATE\tTIME\t\tUSER ID\t\tUSERNAME\tMESSAGE";
window.saveLog = function(stream) {
var d = new Date();
var n = d.toLocaleTimeString().replace(/:/g, ".");
var n1 = d.toLocaleDateString().replace(/\//g, "-");
var textToSave = chatLog;
var hiddenElement = document.createElement('a');
hiddenElement.href = 'data:attachment/text,' + encodeURI(textToSave);
hiddenElement.target = '_blank';
hiddenElement.download = stream + ` Chatlog [${n1} ${n}].json`;
hiddenElement.click();
log("The log files has been saved to \"" + stream + ` Chatlog [${n1} ${n}].json` + "\"", "ATTENTION:", "info");
}
window.lurkBox = document.querySelector("#isTrue");
window.lurk = function() {
window.lurking = !window.lurking;
lurkBox.checked = lurking;
if (window.lurking) {
console.log("%cLurking enabled", "color: white");
}
else {
console.log("%cLurking disabled", "color: white")
}
};
lurkBox.onchange = function (e) {
e.preventDefault();
lurking = lurkBox.checked;
if (window.lurking) {
console.log("%cLurking enabled", "color: white");
log("Lurk mode ENABLED", "ATTENTION:", "info");
}
else {
console.log("%cLurking disabled", "color: white");
log("Lurk mode DISABLED", "ATTENTION:", "info");
}
}
// --------------------------------- Variables ---------------------------------
window.eightBall = ["It is certain.", "It is decidedly so.", "Without a doubt.", "Yes - definitely.", "You may rely on it.", "As I see it, yes.", "Most likely.", "Outlook good.", "Yes.", "Signs point to yes.", "Reply hazy, try again.", "Ask again later.", "Better not tell you now.", "Cannot predict now.", "Concentrate and ask again.", "Don't count on it.", "My reply is no.", "My sources say no.", "Outlook not so good.", "Very doubtful."];
var BadFolk = []; // PLANNING TO MAKE AN ANTI SPAM FEATURE ADDING SPAMMERS TO THIS LIST...