-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
59 lines (52 loc) · 1.77 KB
/
index.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
const noblox = require('noblox.js');
const chalk = require("chalk");
const figlet = require('figlet');
const CronJob = require('cron').CronJob;
require('dotenv').config();
//Main code.
async function findAndApplyDate() {
const weekday = ["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"];
let d = new Date();
let day = weekday[d.getDay()];
switch(day) {
case "Sunday":
noblox.wearAssetId("")
break;
case "Monday":
noblox.wearAssetId("")
break;
case "Tuesday":
noblox.wearAssetId("")
break;
case "Wednesday":
noblox.wearAssetId("")
break;
case "Thursday":
noblox.wearAssetId("")
break;
case "Friday":
noblox.wearAssetId("")
break;
case "Saturday":
noblox.wearAssetId("")
break;
default:
noblox.wearAssetId("") //Fallback.
break;
}
}
//Midnight update.
const job = new CronJob('00 00 00 * * *', function() {
findAndApplyDate();
}, false, process.env.TZ);
//Starter.
async function startApp () {
const currentUser = await noblox.setCookie(process.env.RBLXCOOKIE)
console.log(`${chalk.hex("#5b57d9")(figlet.textSync('Roblox Shirt Daily Updater', { horizontalLayout: 'full' }))}\n`);
console.log(`${chalk.hex('#60bf85')('Bot started!')}\n⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯\n`
+ `${chalk.hex('#ffaa2b')('>')} ${chalk.hex('#7289DA')(`Logged in as: ${chalk.hex('#4e5f99')(`${currentUser.UserName}`)}`)}\n`
+ `${chalk.hex('#ffaa2b')('>')} ${chalk.hex('#7289DA')(`ID: ${chalk.hex('#4e5f99')(`${currentUser.UserID}`)}`)}`);
findAndApplyDate();
job.start();
}
startApp()