lunahub-full
v1.0.0
Published
๐ LunaHUB Full - All-in-One Library with Discord Bot Support
Maintainers
Readme
๐ LunaHUB Full - Complete Discord Bot Framework
LunaHUB Full is the complete all-in-one package with full Discord Bot support! Includes discord.js, webhooks, utilities, and everything you need to build Discord bots! ๐ค๐
โ ๏ธ Important Note
This package includes discord.js and is larger (~80 MB) than the regular lunahub package. Installation takes 30 seconds - 2 minutes.
- Want lightweight? Use
lunahub(500 KB, 3 seconds) - Want full Discord Bot? Use
lunahub-full(80 MB, 1-2 minutes) โ You are here!
โจ Features
- ๐ค Full Discord Bot - Complete discord.js integration
- ๐จ Discord Webhooks - Easy webhook management
- ๐จ Embeds & Buttons - Rich message components
- ๐ HTTP Client - Powerful HTTP requests
- ๐ฐ TrueWallet API - Voucher redemption
- ๐ ๏ธ Utilities - Useful helper functions
- ๐ Crypto - Basic encryption tools
๐ฆ Installation
npm install lunahub-fullRequirements:
- Node.js >= 16.9.0
- Internet connection for Discord API
๐ Quick Start - Discord Bot
Basic Bot Example
const luna = require('lunahub-full');
// Create bot
const bot = luna.discordBot.createBot();
// Bot ready event
bot.on('ready', () => {
console.log(`โ
Bot logged in as ${bot.user.tag}!`);
});
// Simple command
bot.luna.onCommand('!', 'ping', async (message) => {
await message.reply('๐ Pong!');
});
// Login
bot.login('YOUR_BOT_TOKEN');Bot with Embed
const luna = require('lunahub-full');
const bot = luna.discordBot.createBot();
bot.luna.onCommand('!', 'info', async (message) => {
await bot.luna.replyEmbed(message, {
title: '๐ Server Info',
description: 'Information about this server',
color: luna.discordBot.colors.DISCORD,
fields: [
{ name: '๐ฅ Members', value: `${message.guild.memberCount}`, inline: true },
{ name: '๐
Created', value: message.guild.createdAt.toLocaleDateString(), inline: true }
],
thumbnail: message.guild.iconURL(),
footer: 'Powered by LunaHUB Full',
timestamp: true
});
});
bot.on('ready', () => console.log('โ
Bot ready!'));
bot.login('YOUR_BOT_TOKEN');Bot with Buttons
const luna = require('lunahub-full');
const bot = luna.discordBot.createBot();
bot.luna.onCommand('!', 'menu', async (message) => {
const embed = luna.discordBot.createEmbed({
title: '๐ฎ Game Menu',
description: 'Choose an option:',
color: luna.discordBot.colors.BLUE
});
const button1 = luna.discordBot.createButton({
id: 'play',
label: 'Play Game',
style: luna.discordBot.ButtonStyle.Success,
emoji: '๐ฎ'
});
const button2 = luna.discordBot.createButton({
id: 'rules',
label: 'Rules',
style: luna.discordBot.ButtonStyle.Primary,
emoji: '๐'
});
const row = luna.discordBot.createActionRow(button1, button2);
await message.reply({ embeds: [embed], components: [row] });
});
// Handle button clicks
bot.on('interactionCreate', async (interaction) => {
if (!interaction.isButton()) return;
if (interaction.customId === 'play') {
await interaction.reply('๐ฎ Starting game...');
} else if (interaction.customId === 'rules') {
await interaction.reply('๐ Here are the rules...');
}
});
bot.on('ready', () => console.log('โ
Bot ready!'));
bot.login('YOUR_BOT_TOKEN');๐ Complete Bot Examples
Welcome Bot
const luna = require('lunahub-full');
const bot = luna.discordBot.createBot();
bot.on('guildMemberAdd', async (member) => {
const channel = member.guild.channels.cache.find(ch => ch.name === 'welcome');
if (!channel) return;
const embed = luna.discordBot.createEmbed({
title: '๐ Welcome!',
description: `Welcome to the server, ${member.user}!`,
color: luna.discordBot.colors.GREEN,
thumbnail: member.user.displayAvatarURL(),
fields: [
{ name: '๐ Member Count', value: `${member.guild.memberCount}`, inline: true },
{ name: '๐
Account Created', value: member.user.createdAt.toLocaleDateString(), inline: true }
],
footer: 'Enjoy your stay!',
timestamp: true
});
await channel.send({ embeds: [embed] });
});
bot.on('ready', () => console.log('โ
Welcome Bot ready!'));
bot.login('YOUR_BOT_TOKEN');Moderation Bot
const luna = require('lunahub-full');
const bot = luna.discordBot.createBot();
// Kick command
bot.luna.onCommand('!', 'kick', async (message, args) => {
if (!message.member.permissions.has('KickMembers')) {
return message.reply('โ You need Kick Members permission!');
}
const member = message.mentions.members.first();
if (!member) {
return message.reply('โ Please mention a user to kick!');
}
const reason = args.slice(1).join(' ') || 'No reason provided';
try {
await member.kick(reason);
await bot.luna.replyEmbed(message, {
title: 'โ
Member Kicked',
description: `${member.user.tag} has been kicked`,
color: luna.discordBot.colors.SUCCESS,
fields: [
{ name: 'Reason', value: reason },
{ name: 'Moderator', value: message.author.tag }
]
});
} catch (error) {
await message.reply('โ Failed to kick member!');
}
});
bot.on('ready', () => console.log('โ
Mod Bot ready!'));
bot.login('YOUR_BOT_TOKEN');TrueWallet Bot
const luna = require('lunahub-full');
const bot = luna.discordBot.createBot();
bot.luna.onCommand('!', 'redeem', async (message, args) => {
if (args.length < 2) {
return message.reply('Usage: !redeem <voucher_link> <phone>');
}
const [voucherLink, phone] = args;
await message.reply('โณ Redeeming voucher...');
const result = await luna.truewallet.redeemVoucher(voucherLink, phone);
const embed = luna.discordBot.createEmbed({
title: result.status.code === 'SUCCESS' ? 'โ
Voucher Redeemed!' : 'โ Redeem Failed',
description: result.status.message,
color: result.status.code === 'SUCCESS'
? luna.discordBot.colors.SUCCESS
: luna.discordBot.colors.ERROR,
fields: result.data ? [
{ name: '๐ฐ Amount', value: `${result.data.amount} THB`, inline: true },
{ name: '๐ฑ Phone', value: phone, inline: true }
] : [],
timestamp: true
});
await message.reply({ embeds: [embed] });
});
bot.on('ready', () => console.log('โ
TrueWallet Bot ready!'));
bot.login('YOUR_BOT_TOKEN');๐จ Discord Embeds
Create Beautiful Embeds
const embed = luna.discordBot.createEmbed({
title: '๐ Announcement',
description: 'This is an important announcement!',
color: luna.discordBot.colors.DISCORD,
url: 'https://example.com',
author: {
name: 'Admin Team',
iconURL: 'https://example.com/icon.png'
},
fields: [
{ name: 'Category', value: 'Updates', inline: true },
{ name: 'Priority', value: 'High', inline: true },
{ name: 'Details', value: 'Full details here...' }
],
thumbnail: 'https://example.com/thumb.png',
image: 'https://example.com/image.png',
footer: 'Announcement System',
timestamp: true
});
// Send embed
await channel.send({ embeds: [embed] });Available Colors
luna.discordBot.colors = {
RED: 0xFF0000,
GREEN: 0x00FF00,
BLUE: 0x0000FF,
YELLOW: 0xFFFF00,
PURPLE: 0x800080,
ORANGE: 0xFFA500,
DISCORD: 0x5865F2,
SUCCESS: 0x00FF00,
ERROR: 0xFF0000,
WARNING: 0xFFFF00,
INFO: 0x0099FF
}๐จ Webhooks (Still Available!)
// Send simple webhook
await luna.webhook.send('YOUR_WEBHOOK_URL', {
content: 'Hello from LunaHUB Full! ๐ค',
username: 'My Bot',
avatarUrl: 'https://example.com/avatar.png'
});
// Send embed via webhook
const embed = luna.discordBot.createEmbed({
title: 'Webhook Message',
description: 'Sent via webhook!',
color: luna.discordBot.colors.BLUE
});
await luna.webhook.sendEmbed('YOUR_WEBHOOK_URL', embed);๐ HTTP Client
// GET request
const response = await luna.get('https://api.example.com/data');
// POST request
await luna.post('https://api.example.com/users', {
name: 'John',
email: '[email protected]'
});๐ฐ TrueWallet
const result = await luna.truewallet.redeemVoucher(
'https://gift.truemoney.com/campaign/?v=xxxxx',
'0812345678'
);
console.log(result);๐ ๏ธ Utilities
// Sleep
await luna.utils.sleep(1000);
// Random
const num = luna.utils.random(1, 100);
const str = luna.utils.randomString(16);
// Format
console.log(luna.utils.formatNumber(1234567)); // "1,234,567"
console.log(luna.utils.formatDate()); // "2024-11-23 14:30:00"
// Array operations
const chunks = luna.utils.chunk([1,2,3,4,5,6], 2); // [[1,2], [3,4], [5,6]]๐ Full API Reference
Discord Bot
luna.discordBot.createBot(options)- Create Discord bot clientluna.discordBot.createEmbed(options)- Create embedluna.discordBot.createButton(options)- Create buttonluna.discordBot.createActionRow(...buttons)- Create action rowbot.luna.onCommand(prefix, name, callback)- Easy command handlerbot.luna.replyEmbed(message, options)- Quick embed reply
Webhooks
luna.webhook.send(url, options)- Send webhook messageluna.webhook.sendEmbed(url, embed, options)- Send embed
HTTP
luna.get(url, config)- GET requestluna.post(url, data, config)- POST requestluna.put(url, data, config)- PUT requestluna.delete(url, config)- DELETE request
TrueWallet
luna.truewallet.redeemVoucher(link, phone)- Redeem voucher
Utils
luna.utils.sleep(ms)- Delayluna.utils.random(min, max)- Random numberluna.utils.randomString(length)- Random stringluna.utils.formatNumber(num)- Format numberluna.utils.formatDate(date, format)- Format dateluna.utils.chunk(array, size)- Split array
Crypto
luna.crypto.base64Encode(str)- Encode base64luna.crypto.base64Decode(str)- Decode base64luna.crypto.generateToken(length)- Generate token
๐ฏ LunaHUB vs LunaHUB Full
| Feature | lunahub | lunahub-full | |---------|---------|--------------| | HTTP Client | โ | โ | | Webhooks | โ | โ | | TrueWallet | โ | โ | | Utilities | โ | โ | | Discord Bot | โ | โ | | Embeds & Buttons | Basic | Full | | Size | 500 KB | 80 MB | | Install Time | 3 sec | 1-2 min | | Node.js Required | >= 14.0 | >= 16.9 |
๐ก Getting Your Bot Token
- Go to https://discord.com/developers/applications
- Create a "New Application"
- Go to "Bot" section
- Click "Reset Token" and copy it
- Enable necessary intents (Message Content, Server Members, etc.)
- Go to OAuth2 โ URL Generator
- Select bot scope and permissions
- Invite bot to your server
โ ๏ธ Important Notes
- Keep your bot token secret! Never share it publicly
- Enable intents in Discord Developer Portal for bot to work
- Node.js >= 16.9.0 required for discord.js
- Installation takes time due to discord.js size (~80 MB)
๐ฆ Dependencies
axios- HTTP clientdiscord.js- Discord bot library
๐ค Contributing
Contributions welcome! Open issues or PRs on GitHub.
๐ License
MIT ยฉ LunaHUB Team
๐ Links
- npm: https://www.npmjs.com/package/lunahub-full
- Regular Version: https://www.npmjs.com/package/lunahub
- Discord.js Docs: https://discord.js.org
Made with ๐ by LunaHUB Team
