I'll help you create a basic Discord bot structure similar to Bleed but updated for the latest Discord.js version. Let's start with the essentials.
First, make sure you have the latest Discord.js installed:
npm install discord.js@latest dotenv
Here's the basic structure for your "Hate" bot:
1. package.json
{
"name": "hate-bot",
"version": "1.0.0",
"description": "Multi-purpose Discord bot",
"main": "index.js",
"scripts": {
"start": "node index.js",
"dev": "nodemon index.js"
},
"dependencies": {
"discord.js": "^14.14.1",
"dotenv": "^16.3.1"
},
"devDependencies": {
"nodemon": "^3.0.2"
}
}
2. .env
TOKEN=YOUR_BOT_TOKEN_HERE
CLIENT_ID=YOUR_CLIENT_ID_HERE
3. index.js (Main bot file)
require('dotenv').config();
const { Client, GatewayIntentBits, Collection } = require('discord.js');
const fs = require('fs');
const path = require('path');
const client = new Client({
intents: [
GatewayIntentBits.Guilds,
GatewayIntentBits.GuildMessages,
GatewayIntentBits.MessageContent,
GatewayIntentBits.GuildMembers,
]
});
client.commands = new Collection();
client.events = new Collection();
// Load events
const eventsPath = path.join(__dirname, 'events');
const eventFiles = fs.readdirSync(eventsPath).filter(file => file.endsWith('.js'));
for (const file of eventFiles) {
const filePath = path.join(eventsPath, file);
const event = require(filePath);
if (event.once) {
client.once(event.name, (...args) => event.execute(...args, client));
} else {
client.on(event.name, (...args) => event.execute(...args, client));
}
}
// Load commands (we'll add this later)
const commandsPath = path.join(__dirname, 'commands');
client.commands = new Collection();
client.login(process.env.TOKEN);
4. events/ready.js
module.exports = {
name: 'ready',
once: true,
execute(client) {
console.log(`[HATE] Logged in as ${client.user.tag}`);
console.log(`[HATE] Bot is ready and serving ${client.guilds.cache.size} servers`);
// Set bot status
client.user.setActivity('over the server', { type: 3 });
}
};
5. events/messageCreate.js (For prefix commands - optional for now)
module.exports = {
name: 'messageCreate',
execute(message, client) {
// Ignore bots and DMs
if (message.author.bot || !message.guild) return;
// Basic prefix (you can change this)
const prefix = '!';
// Check if message starts with prefix
if (!message.content.startsWith(prefix)) return;
const args = message.content.slice(prefix.length).trim().split(/ +/);
const commandName = args.shift().toLowerCase();
// Log commands (for debugging)
console.log(`[HATE] ${message.author.tag} used: ${commandName}`);
}
};
6. events/interactionCreate.js (For slash commands)
module.exports = {
name: 'interactionCreate',
async execute(interaction, client) {
if (!interaction.isChatInputCommand()) return;
const command = client.commands.get(interaction.commandName);
if (!command) {
console.error(`[HATE] No command matching ${interaction.commandName} was found.`);
return;
}
try {
await command.execute(interaction, client);
} catch (error) {
console.error(`[HATE] Error executing ${interaction.commandName}`);
console.error(error);
const errorReply = {
content: 'There was an error while executing this command!',
ephemeral: true
};
if (interaction.replied || interaction.deferred) {
await interaction.followUp(errorReply);
} else {
await interaction.reply(errorReply);
}
}
}
};
7. config.json (Optional configuration file)
{
"prefix": "!",
"embedColor": "#FF0000",
"ownerIds": ["YOUR_DISCORD_ID"],
"testGuildId": "YOUR_TEST_GUILD_ID"
}
8. Folder Structure
hate-bot/
├── node_modules/
├── commands/
├── events/
│ ├── ready.js
│ ├── messageCreate.js
│ └── interactionCreate.js
├── handlers/
├── utils/
├── index.js
├── package.json
├── package-lock.json
├── .env
└── config.json
To get started:
- Create a new folder called
hate-bot
- Run
npm init -y
- Install dependencies:
npm install discord.js@latest dotenv
- Create the folder structure as shown above
- Add your bot token to the
.env file
- Run the bot:
node index.js
This gives you a solid foundation similar to Bleed's structure but updated for Discord.js v14. The bot will:
- Login successfully
- Show when it's ready
- Listen for messages (for prefix commands)
- Be ready for slash commands
- Have a clean, modular structure
Next steps would be adding:
- Command handler
- Database connection
- More events
- Actual commands
Would you like me to help you add the command handler next, or do you want to test this basic setup first?