- 📝 Note
- 🚧 Requirement
- 📝 Tutorial
- 🔥 Tutorial Firebase
- 🤖 Bot Token And Setting
- 🖥️ Dashboard
- 🧩 Command Example
- 📩 Contact
-
ElianaBot is a free, open-source project built to enhance the Discord experience for communities worldwide. Our goal is to provide a versatile, customizable bot that meets the diverse needs of server owners and their members.
-
Packed with a wide array of features, ElianaBot includes moderation tools, entertainment options, and utility commands designed to make managing and engaging with your Discord server easier. Whether you’re looking to play music, host interactive polls, or share trivia questions, ElianaBot helps create a more dynamic and enjoyable server environment.
-
As an open-source project, we welcome developers of all levels to join our growing community! Feel free to fork ElianaBot from GitHub, tailor it to your needs, and contribute to its ongoing development. Let's build the best community tool together!
- Knowledge of programming, javascript, nodejs, firebase
Go to Firebase
Once You Click Register App You Will Find Above Photo Screenshot But For Database URL Click Continue to console
{
"rules": {
".read": true,
".write": true
}
}
Go To Discord Developer Section And Then Click New Application
Form The Bot Section Click On Reset Token Then Click Yes Do Form Popup And Enter Your Discord Account Password
And You Will Get A Bot Token Copy And Paste It On config.json File And Then Turn On 3 Switch Form Privileged Gateway Intents Section
{
"token": "ADD_BOT_TOKEN",
"prefix": "!",
"firebase": {
"apiKey": "ADD_FIREBASE_API_KEY",
"authDomain": "ADD_FIREBASE_AUTH_DOMAIN",
"databaseURL": "ADD_FIREBASE_DV_URL",
"projectId": "ADD_FIREBASE_PROJECT_ID"
},
"admins": [
"ADMIN_UID"
],
"owners": [
"OWNER_UID"
]
}
Screenshot *Dashboard Code Not Included In This Repo.
Replay With Message
module.exports = {
name: 'ping',
description: 'Replies with Pong!',
execute(message) {
message.reply('Pong!');
},
};
Admin Only Command
const { admins } = require('../config.json'); // Importing the admin list
module.exports = { name: 'hello', description: 'Replies with Hello, but only admins can use it.', execute(message) { // Check if the user is an admin if (!admins.includes(message.author.id)) { return message.reply("❌ You do not have permission to use this command."); } // If the user is an admin, reply with "Hello!" message.reply('Hello!'); }, };
Add Balance To User Account
const { ref, set, get } = require('firebase/database'); // Import Firebase database functions
module.exports = {
name: 'money', // Command name
description: 'Add 10 coins to your account.', // Description of the command
async execute(message, args, client, db) {
const userId = message.author.id; // Get user ID of the person using the command
const guildId = message.guild.id; // Get the ID of the current server
const addAmount = 10; // Fixed amount of 10 coins to add
try {
const userEconomyRef = ref(db, `economy/${guildId}/${userId}`); // Reference to the user's economy data in the database
// Check if the user has an existing economy record
const economySnapshot = await get(userEconomyRef);
if (!economySnapshot.exists()) { // If no record exists, initialize it with a balance of 0
await set(userEconomyRef, { balance: 0 });
}
const userEconomyData = (await get(userEconomyRef)).val(); // Get the user's current balance
// Update the user's balance by adding 10 coins
await set(userEconomyRef, { balance: userEconomyData.balance + addAmount });
// Reply to the user with their new balance
message.reply(`💰 You received 10 coins! Your new balance is ${userEconomyData.balance + addAmount} coins.`);
} catch (error) {
console.error("Error adding money:", error); // Log any errors that occur
message.reply("There was an error trying to add money."); // Inform the user if an error occurs
}
},
};
Spend Balance Form User Account
const { ref, get, set } = require('firebase/database'); // Import Firebase database functions
module.exports = { name: 'spend', // Command name description: 'Spend coins from your account.', // Description of the command async execute(message, args, client, db) { const userId = message.author.id; // Get the ID of the user who triggered the command const guildId = message.guild.id; // Get the ID of the current guild (server) const spendAmount = 50; // Amount to be spent (deducted) try { const userEconomyRef = ref(db,
economy/${guildId}/${userId}
); // Reference to the user's economy data in the database const snapshot = await get(userEconomyRef); // Get the user's current balance if (snapshot.exists()) { const userData = snapshot.val(); const currentBalance = Number(userData.balance); // Convert balance to a number if (isNaN(currentBalance)) { // Check if balance is valid return message.reply("❌ Your balance is invalid. Please contact an administrator."); } if (currentBalance < spendAmount) { // Check if the user has enough coins return message.reply(❌ You don't have enough coins. You need at least ${spendAmount} coins.
); } // Deduct the amount from the user's balance const newBalance = currentBalance - spendAmount; // Update the user's balance in the database await set(userEconomyRef, { ...userData, balance: newBalance }); // Notify the user about the successful transaction message.reply(✅ You spent ${spendAmount} coins. Your new balance is ${newBalance} coins.
); } else { message.reply("❌ You do not have a balance set yet."); } } catch (error) { console.error("Error processing spend command:", error); // Log any errors that occur message.reply("⚡️ An error occurred while processing your request. Please try again later."); } }, };
Discord | Telegram | YouTube | |
---|---|---|---|
Eliana Support Server |
BD_NOOBRA |
HridoyCode |
Hridoy Code |