-
Notifications
You must be signed in to change notification settings - Fork 126
/
Copy pathCurse some text.js
92 lines (73 loc) · 3.23 KB
/
Curse some text.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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
/*
activation_example:!zalgo Some text
regex:(!zalgo|!curse)
flags:gm
*/
var zalgo_mid = [
'\u0315', /* ̕ */ '\u031b', /* ̛ */ '\u0340', /* ̀ */ '\u0341', /* ́ */
'\u0358', /* ͘ */ '\u0321', /* ̡ */ '\u0322', /* ̢ */ '\u0327', /* ̧ */
'\u0328', /* ̨ */ '\u0334', /* ̴ */ '\u0335', /* ̵ */ '\u0336', /* ̶ */
'\u034f', /* ͏ */ '\u035c', /* ͜ */ '\u035d', /* ͝ */ '\u035e', /* ͞ */
'\u035f', /* ͟ */ '\u0360', /* ͠ */ '\u0362', /* ͢ */ '\u0338', /* ̸ */
'\u0337', /* ̷ */ '\u0361' /* ͡ */
];
var zalgoFlag = (current.text.indexOf('!zalgo') > -1);
//Determine substring
var where = (current.text.indexOf((zalgoFlag ? '!zalgo' : '!curse')) + 7);
//Get the term
var term = current.text.substring(where).trim();
//The long string for when users don't specify a term
var badInputStr = 'yoU HaVe MIsused tHe ZalGo CompilER and noW i, tHe BeaST of SErvICENoW HaS BeEN SumMoneD TO Do your bIdding. yoU HaVe MIsused tHe ZalGo CompilER and noW i, tHe BeaST of SErvICENoW HaS BeEN SumMoneD TO Do your bIdding. yoU HaVe MIsused tHe ZalGo CompilER and noW i, tHe BeaST of SErvICENoW HaS BeEN SumMoneD TO Do your bIdding. yoU HaVe MIsused tHe ZalGo CompilER and noW i, tHe BeaST of SErvICENoW HaS BeEN SumMoneD TO Do your bIdding. yoU HaVe MIsused tHe ZalGo CompilER and noW i, tHe BeaST of SErvICENoW HaS BeEN SumMoneD TO Do your bIdding. yoU HaVe MIsused tHe ZalGo CompilER and noW i, tHe BeaST of SErvICENoW HaS BeEN SumMoneD TO Do your bIdding. yoU HaVe MIsused tHe ZalGo CompilER and noW i, tHe BeaST of SErvICENoW HaS BeEN SumMoneD TO Do your bIdding.\n\nJust kidding, you need to include something after !zalgo or !curse for it to work';
var msg = (term ? zalgo_textarea(term) : badInputStr);
var sendIt = new x_snc_slackerbot.Slacker().send_chat(current, msg, false);
function flipString(aString) {
var last = aString.length - 1;
var result = new Array(aString.length);
for (var i = last; i >= 0; --i) {
var c = aString.charAt(i);
var r = flipTable[c];
result[last - i] = r != undefined ? r : c;
}
return result.join('');
}
// rand funcs
//---------------------------------------------------
//gets an int between 0 and max
function rand(max)
{
return Math.floor(Math.random() * max);
}
//gets a random char from a zalgo char table
function rand_zalgo(array)
{
var ind = Math.floor(Math.random() * array.length);
return array[ind];
}
//lookup char to know if its a zalgo char or not
function is_zalgo_char(c)
{
var i;
for(i=0; i<zalgo_mid.length; i++)
if(c == zalgo_mid[i])
return true;
return false;
}
// main shit
//---------------------------------------------------
function zalgo_textarea(text)
{
var txt = text;
var newtxt = '';
for(var i=0; i<txt.length; i++)
{
if(is_zalgo_char(txt.substr(i, 1)))
continue;
//add the normal character
newtxt += txt.substr(i, 1);
var num_mid = rand(2);
for(var j=0; j<num_mid; j++){
newtxt += rand_zalgo(zalgo_mid);
}
}
return newtxt;
}