Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

economy-phoenix

Exiqonbotz410MIT1.2.0

Flexible Economy System for Node.js projects. Originally developed for the Phoenix Bot, now available for general use.

economy, wallet, bank, currency, nodejs, bot, phoenix, money, coins, json-db

readme

economy-phoenix

economy-phoenix ist ein flexibles und einfach integrierbares Economy-System für Node.js-Projekte. Ursprünglich für den Phoenix WhatsApp-Bot entwickelt – jetzt für alle Projekte geeignet.


🚀 Features

  • 💰 Wallet- & Bank-System
  • 📈 Bankkapazität erweiterbar (/cookieupgrade)
  • 🎁 Tägliche Belohnungen (/daily)
  • 🔁 Überweisungen zwischen Nutzern (/transfer)
  • 🏴‍☠️ Ausrauben anderer Nutzer (/rob)
  • 🎢 Erweiterbar für Spiele (Roulette, Blackjack, uvm.)
  • 📂 Speichert in JSON-Dateien – keine zusätzliche Datenbank notwendig

📦 Installation

npm install economy-phoenix

🔧 Beispielnutzung

const eco = require('economy-phoenix');

// Benutzer-Wallet anzeigen
const balance = eco.balance('user-id');
console.log(balance);

// Einzahlung vornehmen
const deposit = eco.deposit('user-id', 500);
console.log(deposit);

// Auszahlung vornehmen
const withdraw = eco.withdraw('user-id', 200);
console.log(withdraw);

// Tägliche Belohnung abholen
const daily = eco.daily('user-id');
console.log(daily);

📂 Speicherort

Standardmäßig wird die Wirtschaft in folgender Datei gespeichert:

./database/economy.json

Du kannst einen eigenen Pfad angeben:

const eco = require('economy-phoenix');
eco.getUserEconomy('user-id', './meinPfad/economy.json');

🛠️ API Referenz

getUserEconomy(userId, dbPath?)

Holt oder erstellt die Wirtschaftsdaten eines Nutzers.

Parameter Typ Beschreibung
userId String ID des Nutzers
dbPath String (optional) Pfad zur JSON-Datenbank (Standard: ./database/economy.json)

Rückgabe:

{
  wallet: Number,
  bank: Number,
  bankCapacity: Number,
  lastDaily: Number,
  cooldowns: Object
}

balance(userId, dbPath?)

Gibt das aktuelle Wallet- & Bankguthaben eines Nutzers zurück.

{
  wallet: Number,
  bank: Number,
  bankCapacity: Number
}

deposit(userId, amount, dbPath?)

Zahlt Geld vom Wallet auf die Bank ein.

{
  noten: Boolean,  // true = Einzahlung fehlgeschlagen
  amount: Number,  // Betrag der eingezahlt wurde
  message?: String // Bei Fehler: z.B. "Bankkapazität überschritten."
}

withdraw(userId, amount, dbPath?)

Hebt Geld von der Bank ab und fügt es dem Wallet hinzu.

{
  noten: Boolean,  // true = Auszahlung fehlgeschlagen
  amount: Number,
  message?: String
}

daily(userId, rewardAmount?, dbPath?)

Tägliche Belohnung erhalten (Standardbetrag: 999).

{
  cd: Boolean,     // true = noch im Cooldown
  cdL: String|null, // verbleibende Zeit, falls cd = true
  amount: Number    // erhaltene Belohnung (0 wenn noch Cooldown)
}

transfer(fromId, toId, amount, dbPath?)

Überweist Guthaben an einen anderen Nutzer.

{
  success: Boolean,
  amount: Number,
  message?: String
}

rob(fromId, toId, maxSteal?, dbPath?)

Versucht, einen anderen Nutzer auszurauben.

{
  success: Boolean,
  amount?: Number,
  message?: String
}

give(userId, amount, dbPath?)

Fügt einem Nutzer Guthaben hinzu. → Rückgabe: true

deduct(userId, amount, dbPath?)

Zieht Guthaben von einem Nutzer ab. → Rückgabe: true | false

giveCapacity(userId, capacity, dbPath?)

Setzt die Bankkapazität eines Nutzers. → Rückgabe: true

loadEconomy(dbPath?)

Lädt die gesamte Datenbank als Objekt.

saveEconomy(db, dbPath?)

Speichert die übergebene Datenbank.


🌍 English Version

economy-phoenix is a flexible and easy-to-use economy system for Node.js projects. Originally developed for the Phoenix WhatsApp Bot – now suitable for all your projects.

🚀 Features

  • 💰 Wallet & Bank System
  • 📈 Upgradeable Bank Capacity (/cookieupgrade)
  • 🎁 Daily Rewards (/daily)
  • 🔁 Transfers Between Users (/transfer)
  • 🏴‍☠️ Rob Other Players (/rob)
  • 🎢 Extendable for Games (Roulette, Blackjack, etc.)
  • 📂 Stores in JSON files – no additional database required

📦 Installation

npm install economy-phoenix

🔧 Example Usage

const eco = require('economy-phoenix');

const balance = eco.balance('user-id');
console.log(balance);

const deposit = eco.deposit('user-id', 500);
console.log(deposit);

const withdraw = eco.withdraw('user-id', 200);
console.log(withdraw);

const daily = eco.daily('user-id');
console.log(daily);

📘 API Reference

getUserEconomy(userId, dbPath?)

Gets or creates user economy data.

{
  wallet: Number,
  bank: Number,
  bankCapacity: Number,
  lastDaily: Number,
  cooldowns: Object
}

balance(userId, dbPath?)

Returns the user's wallet and bank balance.

deposit(userId, amount, dbPath?)

Deposits money from wallet to bank.

withdraw(userId, amount, dbPath?)

Withdraws money from bank to wallet.

daily(userId, rewardAmount?, dbPath?)

Collect daily rewards (default: 999).

transfer(fromId, toId, amount, dbPath?)

Transfers balance to another user.

rob(fromId, toId, maxSteal?, dbPath?)

Attempts to rob another player.

give(userId, amount, dbPath?)

Adds balance to a user.

deduct(userId, amount, dbPath?)

Deducts balance from a user.

giveCapacity(userId, capacity, dbPath?)

Sets a user's bank capacity.

loadEconomy(dbPath?)

Loads the entire database.

saveEconomy(db, dbPath?)

Saves the provided database.

📄 License

MIT License © 2025 Exiqon

changelog

Changelog

Alle wichtigen Änderungen an diesem Projekt werden hier dokumentiert.

Das Format basiert auf Keep a Changelog.

[1.0.3] - 2025-06-17

Added

  • Initiale Veröffentlichung von economy-phoenix
  • Wallet- und Bank-System
  • Einzahlen (deposit)
  • Auszahlen (withdraw)
  • Überweisungen (transfer)
  • Bankkapazität erhöhen (giveCapacity)
  • Tägliche Belohnung (daily)
  • Ausrauben anderer Nutzer (rob)

Repository

  • Projekt auf GitHub veröffentlicht
  • Paket auf npm verfügbar

Changelog

All notable changes to this project will be documented in this file.

The format is based on Keep a Changelog.

[1.0.3] - 2025-06-17

Added

  • Initial release of economy-phoenix
  • Wallet and bank system
  • Deposit (deposit)
  • Withdraw (withdraw)
  • Transfer between users (transfer)
  • Increase bank capacity (giveCapacity)
  • Daily reward system (daily)
  • Rob other users (rob)

Repository

  • Project published on GitHub
  • Package available on npm