forked from DGXeon/CheemsBot-MD6
-
Notifications
You must be signed in to change notification settings - Fork 0
/
console.js
25 lines (20 loc) · 631 Bytes
/
console.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
const chalk = require('chalk')
const color = (text, color) => {
return !color ? chalk.green(text) : chalk.keyword(color)(text)
}
const bgcolor = (text, bgcolor) => {
return !bgcolor ? chalk.green(text) : chalk.bgKeyword(bgcolor)(text)
}
const pickRandom = (arr) => {
return arr[Math.floor(Math.random() * arr.length)]
}
const randomNomor = (min, max = null) => {
if (max !== null) {
min = Math.ceil(min);
max = Math.floor(max);
return Math.floor(Math.random() * (max - min + 1)) + min;
} else {
return Math.floor(Math.random() * min) + 1
}
}
module.exports = { color, bgcolor, pickRandom, randomNomor }