forked from GlaceYT/Bot-ghost-status-remover-by-GlaceYT
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.js
64 lines (56 loc) · 2.13 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
60
61
62
63
64
const { Client, GatewayIntentBits, ActivityType } = require('discord.js');
require('dotenv').config();
const express = require('express');
const path = require('path');
const client = new Client({
intents: [
GatewayIntentBits.Guilds
],
});
const app = express();
const port = 3000;
app.get('/', (req, res) => {
const imagePath = path.join(__dirname, 'index.html');
res.sendFile(imagePath);
});
app.listen(port, () => {
console.log('\x1b[36m[ SERVER ]\x1b[0m', '\x1b[32m SH : http://localhost:' + port + ' ✅\x1b[0m');
});
const statusMessages = ["🚀 Improving products.", "🚀 Looking for something to do", "🚀 Loading files", "🚀 Reading the suggestions", "🚀 Testing Products"];
const statusTypes = [ 'dnd', 'idle'];
let currentStatusIndex = 0;
let currentTypeIndex = 0;
async function login() {
try {
await client.login(process.env.TOKEN);
console.log('\x1b[36m[ LOGIN ]\x1b[0m', `\x1b[32mLogged in as: ${client.user.tag} ✅\x1b[0m`);
console.log('\x1b[36m[ INFO ]\x1b[0m', `\x1b[35mBot ID: ${client.user.id} \x1b[0m`);
console.log('\x1b[36m[ INFO ]\x1b[0m', `\x1b[34mConnected to ${client.guilds.cache.size} server(s) \x1b[0m`);
} catch (error) {
console.error('\x1b[31m[ ERROR ]\x1b[0m', 'Failed to log in:', error);
process.exit(1);
}
}
function updateStatus() {
const currentStatus = statusMessages[currentStatusIndex];
const currentType = statusTypes[currentTypeIndex];
client.user.setPresence({
activities: [{ name: currentStatus, type: ActivityType.Custom }],
status: currentType,
});
console.log('\x1b[33m[ STATUS ]\x1b[0m', `Updated status to: ${currentStatus} (${currentType})`);
currentStatusIndex = (currentStatusIndex + 1) % statusMessages.length;
currentTypeIndex = (currentTypeIndex + 1) % statusTypes.length;
}
function heartbeat() {
setInterval(() => {
console.log('\x1b[35m[ HEARTBEAT ]\x1b[0m', `Bot is alive at ${new Date().toLocaleTimeString()}`);
}, 30000);
}
client.once('ready', () => {
console.log('\x1b[36m[ INFO ]\x1b[0m', `\x1b[34mPing: ${client.ws.ping} ms \x1b[0m`);
updateStatus();
setInterval(updateStatus, 10000);
heartbeat();
});
login();