Spaces:
Runtime error
Runtime error
Delete bot2.js
Browse files
bot2.js
DELETED
|
@@ -1,58 +0,0 @@
|
|
| 1 |
-
const { Client, GatewayIntentBits } = require('discord.js');
|
| 2 |
-
const express = require('express');
|
| 3 |
-
|
| 4 |
-
// ==========================================
|
| 5 |
-
// 1. WEB SERVER (Keeps the bot online 24/7)
|
| 6 |
-
// ==========================================
|
| 7 |
-
const app = express();
|
| 8 |
-
// Using port 7861 by default so it doesn't conflict with FriendlyBot on port 7860
|
| 9 |
-
const port = process.env.PORT || 7861;
|
| 10 |
-
|
| 11 |
-
app.get('/', (req, res) => res.send('Second Bot is online 24/7!'));
|
| 12 |
-
app.get('/healthz', (req, res) => res.status(200).json({ ok: true }));
|
| 13 |
-
|
| 14 |
-
app.listen(port, '0.0.0.0', () => {
|
| 15 |
-
console.log(`🌐 Web server for Second Bot is listening on port ${port}`);
|
| 16 |
-
});
|
| 17 |
-
|
| 18 |
-
// ==========================================
|
| 19 |
-
// 2. DISCORD BOT LOGIC
|
| 20 |
-
// ==========================================
|
| 21 |
-
const client = new Client({
|
| 22 |
-
intents: [
|
| 23 |
-
GatewayIntentBits.Guilds,
|
| 24 |
-
GatewayIntentBits.GuildMessages,
|
| 25 |
-
GatewayIntentBits.MessageContent
|
| 26 |
-
]
|
| 27 |
-
});
|
| 28 |
-
|
| 29 |
-
client.on('ready', () => {
|
| 30 |
-
console.log(`🤖 Second Bot is ONLINE as ${client.user.tag}!`);
|
| 31 |
-
});
|
| 32 |
-
|
| 33 |
-
// Add your custom commands here!
|
| 34 |
-
client.on('messageCreate', async (message) => {
|
| 35 |
-
if (message.author.bot) return;
|
| 36 |
-
|
| 37 |
-
// Example Command 1: !hello
|
| 38 |
-
if (message.content === '!hello') {
|
| 39 |
-
await message.reply('Hello there! I am your new 24/7 bot.');
|
| 40 |
-
}
|
| 41 |
-
|
| 42 |
-
// Example Command 2: !ping
|
| 43 |
-
if (message.content === '!ping') {
|
| 44 |
-
await message.reply(`Pong! Latency is ${client.ws.ping}ms.`);
|
| 45 |
-
}
|
| 46 |
-
});
|
| 47 |
-
|
| 48 |
-
// ==========================================
|
| 49 |
-
// 3. LOGIN TO DISCORD
|
| 50 |
-
// ==========================================
|
| 51 |
-
// Using BOT_TOKEN2 as requested
|
| 52 |
-
const TOKEN = process.env.BOT_TOKEN2;
|
| 53 |
-
|
| 54 |
-
if (!TOKEN) {
|
| 55 |
-
console.error("❌ ERROR: No bot token found! Please add BOT_TOKEN2 to your environment variables.");
|
| 56 |
-
} else {
|
| 57 |
-
client.login(TOKEN);
|
| 58 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|