-
Notifications
You must be signed in to change notification settings - Fork 13
/
Copy pathindex.js
45 lines (37 loc) · 1.28 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
require('colors');
const cron = require('cron');
const readline = require('readline-sync');
const { displayHeader, delay } = require('./src/utils');
const { performCheckIn } = require('./src/checkIn');
const { displayUserData } = require('./src/userData');
(async () => {
displayHeader();
console.log(`Please wait...\n`.yellow);
await delay(1000);
await displayUserData();
console.log('What would you like to do?');
console.log('1. Auto daily check-in');
console.log('0. Exit');
const choice = readline.questionInt('\nEnter your choice: ');
if (choice === 1) {
console.log('Running your first check-in...'.yellow);
await performCheckIn();
const job = new cron.CronJob('0 */12 * * *', () => {
console.log(
`\nPerforming automatic check-in at ${new Date().toLocaleString()}\n`
.green
);
performCheckIn();
});
job.start();
console.log('Cron job set to run every 12 hours.'.green);
} else if (choice === 0) {
console.log('👋 Exiting the bot. See you next time!'.cyan);
console.log('Subscribe: https://t.me/HappyCuanAirdrop.'.green);
process.exit(0);
} else {
console.log('Invalid choice. Exiting...'.red);
console.log('Subscribe: https://t.me/HappyCuanAirdrop.'.green);
process.exit(0);
}
})();