This repository was archived by the owner on Mar 6, 2026. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 970
Expand file tree
/
Copy pathindex.js
More file actions
157 lines (131 loc) · 4.97 KB
/
Copy pathindex.js
File metadata and controls
157 lines (131 loc) · 4.97 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
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
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
const { Client, GatewayIntentBits, SlashCommandBuilder, REST, Routes, EmbedBuilder, ActionRowBuilder, ButtonBuilder, ButtonStyle, Events } = require('discord.js');
const fs = require('fs');
require('dotenv').config();
const TOKEN = process.env.TOKEN;
const CLIENT_ID = process.env.CLIENT_ID;
const client = new Client({
intents: [GatewayIntentBits.Guilds, GatewayIntentBits.GuildMessages],
});
const commands = [
new SlashCommandBuilder()
.setName('active-dev-badge')
.setDescription('Start your 24hr Active Developer Badge timer!'),
].map(command => command.toJSON());
const rest = new REST({ version: '10' }).setToken(TOKEN);
(async () => {
try {
console.log('Registering PUBLIC slash command...');
await rest.put(
Routes.applicationCommands(CLIENT_ID),
{ body: commands }
);
console.log('✅ Public slash command registered');
client.once('ready', async () => {
console.log(`Logged in as ${client.user.tag}`);
// Set bot's status
client.user.setActivity('chill with manish', { type: 3 }); // Type 3 is "Watching"
// Set bot's about me with watermark
const watermark = "Made with ❤️ by Manish | Active Developer Badge Bot | Get your badge in 24 hours!";
// Function to ensure watermark stays
const ensureWatermark = async () => {
try {
await client.application.edit({
description: watermark
});
} catch (error) {
console.error('Failed to update application description:', error);
}
};
// Set initial watermark
await ensureWatermark();
// Check and reset watermark every 5 minutes
setInterval(ensureWatermark, 5 * 60 * 1000);
});
client.on(Events.InteractionCreate, async interaction => {
if (!interaction.isChatInputCommand()) return;
if (interaction.commandName !== 'active-dev-badge') return;
const userId = interaction.user.id;
let userTimers = {};
// Read existing timers
try {
userTimers = JSON.parse(fs.readFileSync('./userTimers.json'));
} catch (error) {
console.error('Error reading timer file:', error);
}
const now = Date.now();
let future;
let timeLeft;
// Check if user already has an active timer
if (userTimers[userId] && userTimers[userId] > now) {
future = userTimers[userId];
timeLeft = `<t:${Math.floor(future / 1000)}:R>`;
} else {
// Set new timer
future = now + 24 * 60 * 60 * 1000;
timeLeft = `<t:${Math.floor(future / 1000)}:R>`;
userTimers[userId] = future;
// Save to file
fs.writeFileSync('./userTimers.json', JSON.stringify(userTimers, null, 2));
}
const embed = new EmbedBuilder()
.setTitle('🚀 Active Developer Badge Timer')
.setDescription(`
**Congratulations!** Your 24-hour timer has been activated.
⏰ **Timer Ends:** ${timeLeft}
Once the timer completes, click the button below to claim your **Active Developer Badge**!
`)
.addFields(
{
name: '📋 Instructions',
value: `
• Wait for the full 24 hours to pass
• Click the "Claim Badge" button below
• Complete the verification process
• Enjoy your new badge! 🎉
`,
inline: false
},
{
name: '⚡ Quick Links',
value: `
🔗 [Developer Portal](https://discord.com/developers/applications)
📚 [Our website](https://roxy-selfbot.vercel.app/)
💡 [Support Server](https://discord.gg/hZf4j8GzzK)
`,
inline: true
},
{
name: '🎯 Badge Benefits',
value: `
✨ Exclusive profile badge
🎖️ Community status
🚀 flex maybe
`,
inline: true
}
)
.setColor('#00D4AA')
.setThumbnail('https://cdn.discordapp.com/attachments/1395245783808348331/1400354191624372375/0d02b202baf618dc122475bf70350fd9.png')
.setFooter({
text: '🔥 Active Developer Badge bot | Made with ❤️ by Manish',
iconURL: 'https://cdn.discordapp.com/attachments/1332936607267033138/1400353273906593844/image_8.png'
})
.setTimestamp()
.setImage('https://cdn.discordapp.com/attachments/1395245783808348331/1400351640028053556/20250731_102557.png');
const row = new ActionRowBuilder().addComponents(
new ButtonBuilder()
.setLabel('🏆 Claim Your Badge')
.setStyle(ButtonStyle.Link)
.setURL('https://discord.com/developers/active-developer')
);
await interaction.reply({
embeds: [embed],
components: [row],
ephemeral: false
});
});
client.login(TOKEN);
} catch (err) {
console.error(err);
}
})();