-
Notifications
You must be signed in to change notification settings - Fork 0
/
randomdle.js
64 lines (59 loc) · 1.74 KB
/
randomdle.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
// authenticates you with the API standard library
// type `await lib.` to display API autocomplete
const lib = require('lib')({token: process.env.STDLIB_SECRET_TOKEN});
function getRandomInt(min, max) {
min = Math.ceil(min);
max = Math.floor(max);
return Math.floor(Math.random() * (max - min + 1)) + min;
}
let wordleWidth = getRandomInt(5,9);
let wordleHeight = getRandomInt(2,6);
let wordleAttempts = wordleHeight + 1;
let wordleDay = getRandomInt(1,365);
let line = [];
let squareColorNbr;
line.push('Randomdle ' + '#' + `${wordleDay} ` + `${wordleAttempts}` + '/7' + '\n' + '\n');
for (j=0; j<wordleHeight; j++) {
for (i=0; i<wordleWidth; i++) {
squareColorNbr = getRandomInt(1,10);
if (squareColorNbr == 1) {
line.push(`:green_square:`);
}
else if (squareColorNbr == 2) {
line.push(`:green_square:`);
}
else if (squareColorNbr == 3) {
line.push(`:orange_square:`);
}
else if (squareColorNbr == 4) {
line.push(`:orange_square:`);
}
else if (squareColorNbr == 5) {
line.push(`:orange_square:`);
}
else if (squareColorNbr == 6) {
line.push(`:black_medium_square:`);
}
else if (squareColorNbr == 7) {
line.push(`:black_medium_square:`);
}
else if (squareColorNbr == 8) {
line.push(`:black_medium_square:`);
}
else if (squareColorNbr == 9) {
line.push(`:black_medium_square:`);
}
else if (squareColorNbr == 10) {
line.push(`:black_medium_square:`);
}
}
line.push('\n');
}
for (i=0; i<wordleWidth; i++) {
line.push(`:green_square:`);
}
line.push('\n');
let result = await lib.discord.channels['@0.2.2'].messages.create({
channel_id: `${context.params.event.channel_id}`,
content: line.join(' ')
});