-
Notifications
You must be signed in to change notification settings - Fork 3
/
app.js
84 lines (75 loc) · 2.58 KB
/
app.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
import boidInfo from './data/data.js'
import promptSync from 'prompt-sync'
import { createSpinner } from 'nanospinner'
import { config } from 'dotenv'
import colors from 'colors'
import { getData, result } from './utils/index.js'
colors.enable()
config()
const prompt = promptSync()
const sleep = (ms = 2000) => new Promise((r) => setTimeout(r, ms))
;(async () => {
try {
const data = await getData()
if (data.error) {
throw new Error('Data Not Found!')
}
const details = data.body.companyShareList.map((company) => {
if (company.name.includes('FOREIGN EMPLOYMENT)')) {
return
}
return { id: company.id, name: company.name }
})
details.map((a) => {
if (!a || a.name.includes('FOREIGN EMPLOYMENT')) {
return
}
console.log(a.id, '=>', a.name)
return a.id, '=>', a.name
})
console.log()
let userID = null
try {
userID = prompt('Choose: ')
} catch (e) {
userID = '1'
}
const checking = details.filter((a) => a?.id == userID)[0]
console.log(
'\nChecking Result of'.green,
`${checking?.name}`.magenta.underline
)
boidInfo.map(async (user) => {
if (!user) {
return
}
if (user.boid) {
const captchaSpinner =
createSpinner('Solving CAPTCHA...').start()
await sleep()
result(user?.boid, captchaSpinner, userID).then((r) =>
typeof r === 'undefined'
? console.log(
`${user.name} => Possible Error: Incorrect BOID: ${user.boid}`
.yellow + '\n'
)
: r.success === true
? console.log(
`Congratulations! ${
user.name
}. IPO Alloted. Alloted quantity: ${
r.message.split(' ')[6]
} `.bgGreen.black + '\n'
)
: r.success === false &&
console.log(
`${user.name} => Sorry not Alloted`.yellow + '\n'
)
)
}
})
} catch (error) {
console.error(`\nError: ${error.message}`.red)
process.exit(1)
}
})()