Repository navigation
Weky Integration
M3rcena edited this page Nov 1, 2026
·
1 revision
This guide explains how @m3rcena/eco connects with @m3rcena/weky to reward players for playing Discord minigames, handle PvP wagering with automated escrow, distribute solo high score multipliers, and disburse tournament prize pools.
Connect your EcoManager to WekyManager in one line:
import { Client } from "discord.js";
import { EcoManager } from "@m3rcena/eco";
import { WekyManager } from "@m3rcena/weky";
const client = new Client({ intents: [/* ... */] });
export const eco = new EcoManager({ database: "sqlite" });
export const weky = new WekyManager(client, { database: "sqlite" });
// Initialize the connector
export const connector = eco.connectWeky(weky, {
defaultWinReward: 50, // 50 coins awarded on victory
defaultLossPenalty: 0, // No penalty on defeat
defaultDrawReward: 10, // 10 coins on draw/tie
defaultScoreMultiplier: 0.05, // Solo score multiplier (1000 pts = 50 coins)
maxScoreReward: 500, // Score cap
streakBonus: 10, // +10 bonus coins per active win streak count
tournamentChampionPrize: 500, // Tournament champion prize
wagerHouseFee: 5, // 5% house fee deducted from PvP pots
});Players can bet coins on PvP games (Tic-Tac-Toe, Fight RPG, Rock Paper Scissors, etc.). The connector escrows the funds atomically, checks balances, and pays the winner when the match concludes:
// Escrow funds for a match
const wagerRes = await connector.createWager({
wagerId: interaction.channelId,
player1Id: player1.id,
player2Id: player2.id,
amount: 250, // 250 coins each -> 500 coin total pot
game: "fight",
guildId: interaction.guildId,
});
if (!wagerRes.success) {
return interaction.reply({
content: `โ Could not start wager: ${wagerRes.reason}`,
ephemeral: true,
});
}
// Start game
await weky.createFight({
context: interaction,
opponent: player2,
});
// When the fight ends, the connector resolves the wager automatically!| Option | Type | Default | Description |
|---|---|---|---|
defaultWinReward |
number |
50 |
Flat coins awarded upon winning any minigame. |
defaultLossPenalty |
number |
0 |
Flat coins deducted upon defeat. |
defaultDrawReward |
number |
10 |
Flat coins awarded upon a tie/draw. |
defaultScoreMultiplier |
number |
0.05 |
Coins awarded per point in solo games (e.g. 2048, Snake). |
maxScoreReward |
number |
500 |
Maximum coins a single solo game can award from score. |
streakBonus |
number |
5 |
Bonus coins per consecutive win streak count. |
tournamentChampionPrize |
number |
500 |
Cash prize awarded to tournament winners. |
tournamentRunnerUpPrize |
number |
200 |
Cash prize awarded to 2nd place in tournaments. |
wagerHouseFee |
number |
0 |
Percentage (0-100) taken from PvP wager pots as a house tax. |
autoReward |
boolean |
true |
Whether to automatically listen for gameOver and tournamentEnd events. |
games |
Record<string, EcoGameRewardRule> |
{} |
Per-game overrides for any of the above settings. |
Built with โค๏ธ by M3rcena Development โข @m3rcena/eco v14.28.1 โข Licensed under Apache-2.0
GitHub: M3rcena/m3rcena-eco โข NPM: @m3rcena/eco
GitHub: M3rcena/m3rcena-eco โข NPM: @m3rcena/eco
- Bank Vaults & Compound Interest
- FICO Credit Scoring (300-850)
- Bank Loans & Debt
- Municipal Utility Bills
- Progressive Wealth Taxes & Evasion
- Interactive Blackjack Table
- Slot Machine (50x Mega Jackpot)
- European Roulette
- Crash Multiplier Simulator
- Coinflip & Dice
- Simulated Stock & Crypto Exchange
- Multiplayer Syndicate Heists
- Companion Pets & Foraging
- Mystery Loot Crates
- Dashboard Bridge Integration
- Weky Minigames Integration
- Complete REST API Reference
- Scoped Audio Cues Table