New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details β†’ β†’
Socket
Book a DemoSign in
Socket

lunahub

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

lunahub

πŸŒ™ LunaHUB - Ultimate All-in-One JavaScript Library

latest
npmnpm
Version
3.0.0
Version published
Maintainers
1
Created
Source

πŸŒ™ LunaHUB - Ultimate All-in-One JavaScript Library

npm version license node version

LunaHUB is the ultimate all-in-one JavaScript library for Node.js. HTTP client, Discord webhooks, TrueWallet API, utilities, and more - all in one package! πŸš€

✨ Features

  • 🌐 HTTP Client - Powerful HTTP requests with auto-retry
  • πŸ€– Discord Integration - Easy Discord webhook management
  • πŸ’° TrueWallet API - Redeem vouchers automatically
  • πŸ› οΈ Utilities - Useful helper functions
  • πŸ” Crypto - Basic encryption/encoding tools
  • πŸ“Š API Wrappers - Pre-built API integrations
  • 🎯 Easy to Use - Simple, intuitive API

πŸ“¦ Installation

npm install lunahub

πŸš€ Quick Start

const luna = require('lunahub');

// HTTP Request
const response = await luna.get('https://api.example.com/data');

// Discord Webhook
await luna.discord.sendWebhook('YOUR_WEBHOOK_URL', {
    content: 'Hello from LunaHUB! πŸŒ™'
});

// TrueWallet
const result = await luna.truewallet.redeemVoucher('VOUCHER_LINK', '0812345678');

// Utilities
await luna.utils.sleep(1000);
console.log(luna.utils.randomString(16));

πŸ“– Documentation

🌐 HTTP Client

Basic Requests

const luna = require('lunahub');

// GET request
const data = await luna.get('https://api.example.com/users');

// POST request
const result = await luna.post('https://api.example.com/users', {
    name: 'John Doe',
    email: 'john@example.com'
});

// PUT request
await luna.put('https://api.example.com/users/1', { name: 'Jane' });

// DELETE request
await luna.delete('https://api.example.com/users/1');

Advanced Usage

// Custom configuration
const response = await luna.request({
    method: 'POST',
    url: 'https://api.example.com/data',
    headers: {
        'Authorization': 'Bearer TOKEN',
        'Content-Type': 'application/json'
    },
    data: { key: 'value' },
    timeout: 5000
});

// Create custom instance with options
const customLuna = luna.create({
    timeout: 10000,
    maxRetries: 5,
    debug: true
});

πŸ€– Discord Integration

Send Simple Message

await luna.discord.sendWebhook('YOUR_WEBHOOK_URL', {
    content: 'Hello Discord! πŸ‘‹',
    username: 'LunaBot',
    avatarUrl: 'https://example.com/avatar.png'
});

Create and Send Embed

const embed = luna.discord.createEmbed({
    title: 'πŸŽ‰ New Update!',
    description: 'LunaHUB v2.0 is now available!',
    color: luna.discord.colors.DISCORD,
    fields: [
        { name: 'πŸ“¦ Version', value: '2.0.0', inline: true },
        { name: 'πŸ“… Date', value: '2024-11-23', inline: true }
    ],
    thumbnail: 'https://example.com/logo.png',
    footer: 'Powered by LunaHUB',
    timestamp: true
});

await luna.discord.sendEmbed('YOUR_WEBHOOK_URL', embed);

Multiple Embeds

const embed1 = luna.discord.createEmbed({
    title: 'First Embed',
    color: luna.discord.colors.GREEN
});

const embed2 = luna.discord.createEmbed({
    title: 'Second Embed',
    color: luna.discord.colors.BLUE
});

await luna.discord.sendWebhook('YOUR_WEBHOOK_URL', {
    content: 'Check out these embeds!',
    embeds: [embed1, embed2]
});

Available Colors

luna.discord.colors = {
    RED: 0xFF0000,
    GREEN: 0x00FF00,
    BLUE: 0x0000FF,
    YELLOW: 0xFFFF00,
    PURPLE: 0x800080,
    ORANGE: 0xFFA500,
    DISCORD: 0x5865F2,
    SUCCESS: 0x00FF00,
    ERROR: 0xFF0000,
    WARNING: 0xFFFF00,
    INFO: 0x0099FF
}

πŸ’° TrueWallet API

Redeem Voucher

const result = await luna.truewallet.redeemVoucher(
    'https://gift.truemoney.com/campaign/?v=xxxxx',
    '0812345678'
);

if (result.status.code === 'SUCCESS') {
    console.log(`βœ… Received ${result.data.amount} THB`);
} else {
    console.log(`❌ Error: ${result.status.message}`);
}

Redeem Multiple Vouchers

const vouchers = [
    'https://gift.truemoney.com/campaign/?v=xxxxx1',
    'https://gift.truemoney.com/campaign/?v=xxxxx2',
    'https://gift.truemoney.com/campaign/?v=xxxxx3'
];

for (const voucher of vouchers) {
    const result = await luna.truewallet.redeemVoucher(voucher, '0812345678');
    console.log(result);
    await luna.utils.sleep(1000); // Wait 1 second between requests
}

πŸ› οΈ Utilities

Sleep/Delay

await luna.utils.sleep(1000); // Sleep for 1 second
await luna.utils.sleep(5000); // Sleep for 5 seconds

Random Numbers

const num = luna.utils.random(1, 100); // Random number between 1-100
console.log(num);

Random String

const token = luna.utils.randomString(32); // Random 32-char string
const code = luna.utils.randomString(8);   // Random 8-char string

Format Number

console.log(luna.utils.formatNumber(1234567)); // "1,234,567"
console.log(luna.utils.formatNumber(999999));  // "999,999"

Chunk Array

const numbers = [1, 2, 3, 4, 5, 6, 7, 8, 9];
const chunks = luna.utils.chunk(numbers, 3);
// [[1, 2, 3], [4, 5, 6], [7, 8, 9]]

Parse JSON Safely

const data = luna.utils.parseJSON('{"name":"John"}'); // Returns object
const invalid = luna.utils.parseJSON('invalid json', {}); // Returns {}

Timestamps

const now = luna.utils.timestamp(); // Unix timestamp (seconds)
const formatted = luna.utils.formatDate(); // "2024-11-23 14:30:00"
const custom = luna.utils.formatDate(new Date(), 'YYYY/MM/DD'); // "2024/11/23"

πŸ” Crypto

Base64 Encoding

const encoded = luna.crypto.base64Encode('Hello World');
console.log(encoded); // "SGVsbG8gV29ybGQ="

const decoded = luna.crypto.base64Decode(encoded);
console.log(decoded); // "Hello World"

Generate Token

const token = luna.crypto.generateToken(); // 64-char hex token
const shortToken = luna.crypto.generateToken(16); // 32-char hex token

πŸ“Š Built-in API Wrappers

JSONPlaceholder

// Get all posts
const posts = await luna.api.jsonPlaceholder.getPosts();

// Get single post
const post = await luna.api.jsonPlaceholder.getPost(1);

// Create post
const newPost = await luna.api.jsonPlaceholder.createPost({
    title: 'My Post',
    body: 'Post content',
    userId: 1
});

Random User

const user = await luna.api.randomUser();
console.log(user.name.first, user.name.last);
console.log(user.email);
console.log(user.picture.large);

Cat Facts

const fact = await luna.api.catFact();
console.log(`🐱 ${fact}`);

Random Dog Image

const dogUrl = await luna.api.randomDog();
console.log(`🐢 ${dogUrl}`);

🎯 Complete Example: Discord Bot Alert

const luna = require('lunahub');

async function sendAlert(webhookUrl) {
    // Create embed
    const embed = luna.discord.createEmbed({
        title: '🚨 System Alert',
        description: 'Server is running smoothly',
        color: luna.discord.colors.SUCCESS,
        fields: [
            { name: 'Status', value: 'βœ… Online', inline: true },
            { name: 'Uptime', value: '24h', inline: true },
            { name: 'CPU', value: '45%', inline: true },
            { name: 'Memory', value: '2.4 GB', inline: true }
        ],
        footer: 'Powered by LunaHUB',
        timestamp: true
    });

    // Send to Discord
    await luna.discord.sendEmbed(webhookUrl, embed, {
        username: 'Server Monitor',
        avatarUrl: 'https://example.com/bot.png'
    });

    console.log('βœ… Alert sent to Discord!');
}

sendAlert('YOUR_WEBHOOK_URL');

🎯 Complete Example: TrueWallet Bot

const luna = require('lunahub');

async function redeemAndNotify(voucherLink, phoneNumber, webhookUrl) {
    // Redeem voucher
    const result = await luna.truewallet.redeemVoucher(voucherLink, phoneNumber);
    
    // Create embed based on result
    const embed = luna.discord.createEmbed({
        title: result.status.code === 'SUCCESS' ? 'βœ… Voucher Redeemed!' : '❌ Redeem Failed',
        description: result.status.message,
        color: result.status.code === 'SUCCESS' 
            ? luna.discord.colors.SUCCESS 
            : luna.discord.colors.ERROR,
        fields: result.data ? [
            { name: 'πŸ’° Amount', value: `${result.data.amount} THB`, inline: true },
            { name: 'πŸ“± Phone', value: phoneNumber, inline: true }
        ] : [],
        timestamp: true
    });
    
    // Send to Discord
    await luna.discord.sendEmbed(webhookUrl, embed);
    
    return result;
}

redeemAndNotify(
    'https://gift.truemoney.com/campaign/?v=xxxxx',
    '0812345678',
    'YOUR_WEBHOOK_URL'
);

πŸ“‹ API Reference Summary

HTTP Client

  • luna.request(config) - Make HTTP request
  • luna.get(url, config) - GET request
  • luna.post(url, data, config) - POST request
  • luna.put(url, data, config) - PUT request
  • luna.delete(url, config) - DELETE request

Discord

  • luna.discord.sendWebhook(url, options) - Send message
  • luna.discord.createEmbed(options) - Create embed
  • luna.discord.sendEmbed(url, embed, options) - Send embed
  • luna.discord.colors - Color presets

TrueWallet

  • luna.truewallet.redeemVoucher(link, phone) - Redeem voucher

Utils

  • luna.utils.sleep(ms) - Delay
  • luna.utils.random(min, max) - Random number
  • luna.utils.randomString(length) - Random string
  • luna.utils.formatNumber(num) - Format number
  • luna.utils.chunk(array, size) - Split array
  • luna.utils.parseJSON(str, fallback) - Parse JSON
  • luna.utils.timestamp() - Unix timestamp
  • luna.utils.formatDate(date, format) - Format date

Crypto

  • luna.crypto.base64Encode(str) - Encode base64
  • luna.crypto.base64Decode(str) - Decode base64
  • luna.crypto.generateToken(length) - Generate token

APIs

  • luna.api.jsonPlaceholder.* - Test API
  • luna.api.randomUser() - Random user data
  • luna.api.catFact() - Cat fact
  • luna.api.randomDog() - Dog image

🌟 Why LunaHUB?

  • βœ… All-in-One - Everything you need in one package
  • βœ… Easy to Use - Simple, intuitive API
  • βœ… Well Documented - Clear examples and guides
  • βœ… Auto Retry - Built-in error handling
  • βœ… Lightweight - Minimal dependencies
  • βœ… Active Development - Regular updates

πŸ“¦ Dependencies

  • axios - HTTP client

🀝 Contributing

Contributions, issues, and feature requests are welcome!

πŸ“„ License

MIT Β© LunaHUB Team

  • npm: https://www.npmjs.com/package/lunahub
  • GitHub: https://github.com/yourusername/lunahub

πŸ“œ Changelog

v2.0.0 (2024-11-23)

  • πŸŽ‰ Major rewrite - All-in-One library
  • βœ… Added Discord webhook integration
  • βœ… Added TrueWallet API module
  • βœ… Added utilities module
  • βœ… Added crypto module
  • βœ… Added API wrappers
  • βœ… Improved error handling
  • βœ… Better documentation

v1.0.0 (2024-11-23)

  • πŸŽ‰ Initial release

Made with πŸŒ™ by LunaHUB Team

Keywords

http

FAQs

Package last updated on 22 Nov 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts