-
Notifications
You must be signed in to change notification settings - Fork 1.6k
/
index.js
102 lines (80 loc) · 3.38 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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
/*
☆.。.:*・°☆.。.:*・°☆.。.:*・°☆.。.:*・°☆
_________ ___ ___ ._______ _________
/ _____// | \| \ \ / / _ \
\_____ \/ ~ \ |\ Y / /_\ \
/ \ Y / | \ / | \
/_______ /\___|_ /|___| \___/\____|__ /
\/ \/ \/
DISCORD : https://discord.com/invite/xQF9f9yUEM
YouTube : https://www.youtube.com/@GlaceYT
☆.。.:*・°☆.。.:*・°☆.。.:*・°☆.。.:*・°☆
*/
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 = ["🎧 Listening to Spotify", "🎮 Playing VALORANT"];
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();
/*
☆.。.:*・°☆.。.:*・°☆.。.:*・°☆.。.:*・°☆
_________ ___ ___ ._______ _________
/ _____// | \| \ \ / / _ \
\_____ \/ ~ \ |\ Y / /_\ \
/ \ Y / | \ / | \
/_______ /\___|_ /|___| \___/\____|__ /
\/ \/ \/
DISCORD : https://discord.com/invite/xQF9f9yUEM
YouTube : https://www.youtube.com/@GlaceYT
☆.。.:*・°☆.。.:*・°☆.。.:*・°☆.。.:*・°☆
*/