-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcheck.js
More file actions
76 lines (68 loc) · 2.03 KB
/
check.js
File metadata and controls
76 lines (68 loc) · 2.03 KB
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
// Simple startup check script
const fs = require('fs')
const path = require('path')
console.log('\n🔍 RRPBOT Startup Checklist\n')
const checks = [
{
name: 'package.json',
check: () => fs.existsSync('package.json'),
fix: 'File exists'
},
{
name: '.env file',
check: () => fs.existsSync('.env'),
fix: 'Run: npm run setup OR copy .env.example to .env'
},
{
name: 'node_modules',
check: () => fs.existsSync('node_modules'),
fix: 'Run: npm install'
},
{
name: 'src/index.ts',
check: () => fs.existsSync('src/index.ts'),
fix: 'Main bot file missing'
},
{
name: 'DISCORD_TOKEN in .env',
check: () => {
if (!fs.existsSync('.env')) return false
const env = fs.readFileSync('.env', 'utf8')
return env.includes('DISCORD_TOKEN=') && !env.includes('DISCORD_TOKEN=your_bot_token_here')
},
fix: 'Set your Discord bot token in .env file'
},
{
name: 'CLIENT_ID in .env',
check: () => {
if (!fs.existsSync('.env')) return false
const env = fs.readFileSync('.env', 'utf8')
return env.includes('CLIENT_ID=') && !env.includes('CLIENT_ID=your_client_id_here')
},
fix: 'Set your Discord client ID in .env file'
},
]
let allPassed = true
checks.forEach(({ name, check, fix }) => {
const passed = check()
const icon = passed ? '✅' : '❌'
console.log(`${icon} ${name}`)
if (!passed) {
console.log(` → ${fix}\n`)
allPassed = false
}
})
console.log('\n' + '='.repeat(50))
if (allPassed) {
console.log('✅ All checks passed! You can start the bot with:')
console.log(' npm run dev\n')
} else {
console.log('❌ Some checks failed. Please fix them first.\n')
console.log('Quick setup: npm run setup\n')
}
// Check MongoDB connection (optional)
console.log('Optional checks:')
console.log('⚠️ MongoDB - Make sure MongoDB is running')
console.log(' Test: mongosh (or mongo)')
console.log('⚠️ Commands deployed - Run: npm run deploy')
console.log(' (Required before bot can respond to slash commands)\n')