Build a mini economy plugin under two commands: /eco work earns coins with a cooldown, /eco balance checks them, /eco pay sends some to another member, /eco top lists the richest, and /store list and /store buy trade three roles
A simple economy system with earning, trading, and rewards.
Coins:
/eco work — Earn coins (1-hour cooldown by default)/eco balance — Check your coins or someone else's/eco pay — Send coins to another member/eco top — Leaderboard of the richest membersShop:
/store list — View roles available for purchase/store buy — Buy a role with your coinsSetup: Admins configure three shop roles and their prices in the dashboard. The test server creates sample roles (Bronze, Silver, Gold) so you can try it immediately.
Made by MEE6. Remix it to get a copy of your own and change anything you like.
💼 You worked and earned 100 coins! Balance: 100 coins
💼 You worked and earned 100 coins! Balance: 100 coins
💸 You sent 100 coins to @You!
@Bronze — 💰 500 coins @Silver — 💰 1000 coins @Gold — 💰 2000 coins
⏰ You need to wait 60m 0s before working again.
💼 You worked and earned 100 coins! Balance: 300 coins
💼 You worked and earned 100 coins! Balance: 400 coins
💼 You worked and earned 100 coins! Balance: 500 coins
✅ You bought @Bronze for 500 coins!
@Bronze — ✅ Owned @Silver — 💰 1000 coins @Gold — 💰 2000 coins
// Mini Economy - earn coins, buy roles
mee6.settings({
work_amount: { type: 'integer', label: 'Coins per /eco work', default: 100, sample: 100 },
work_cooldown: { type: 'integer', label: 'Work cooldown (seconds)', default: 3600, sample: 3600 },
shop_role_1: { type: 'role', label: 'Shop role 1', sample: 'Bronze' },
shop_price_1: { type: 'integer', label: 'Price for role 1', default: 500, sample: 500 },
shop_role_2: { type: 'role', label: 'Shop role 2', sample: 'Silver' },
shop_price_2: { type: 'integer', label: 'Price for role 2', default: 1000, sample: 1000 },
shop_role_3: { type: 'role', label: 'Shop role 3', sample: 'Gold' },
shop_price_3: { type: 'integer', label: 'Price for role 3', default: 2000, sample: 2000 },
});
// /eco work - earn coins with cooldown
mee6.command('eco work', { description: 'Work to earn coins' }, async (ctx) => {
const m = mee6.store.member(ctx.author.id);
const now = Math.floor(Date.now() / 1000);
const lastWork = await m.get<number>('last_work', 0);
const cooldown = ctx.settings.work_cooldown ?? 3600;
if (now - lastWork < cooldown) {
const remaining = cooldown - (now - lastWork);
const minutes = Math.floor(remaining / 60);
const seconds = remaining % 60;
await ctx.reply(`⏰ You need to wait ${minutes}m ${seconds}s before working again.`);
return;
}
const amount = ctx.settings.work_amount ?? 100;
const newBalance = await m.incr('coins', amount);
await m.set('last_work', now);
await ctx.reply(`💼 You worked and earned **${amount}** coins! Balance: **${newBalance}** coins`);
});
// /eco balance - check your coins
mee6.command(
'eco balance',
{
description: 'Check your coin balance',
options: [{ name: 'user', type: 'user', description: "Check another user's balance" }],
},
async (ctx) => {
const targetId = ctx.option<string>('user') ?? ctx.author.id;
const targetMember = targetId === ctx.author.id ? ctx.author : await mee6.getMember(targetId);
if (!targetMember) {
await ctx.reply('❌ User not found.');
return;
}
const m = mee6.store.member(targetId);
const coins = await m.get<number>('coins', 0);
await ctx.reply({
embed: {
title: '💰 Coin Balance',
description: `${targetMember.displayName} has **${coins}** coins`,
color: '#f1c40f',
thumbnail_url: targetMember.avatarUrl,
},
});
}
);
// /eco pay - send coins to another member
mee6.command(
'eco pay',
{
description: 'Send coins to another member',
options: [
{ name: 'user', type: 'user', description: 'Who to pay', required: true },
{ name: 'amount', type: 'integer', description: 'Amount to send', required: true },
],
},
async (ctx) => {
const targetId = ctx.option<string>('user');
const amount = ctx.option<number>('amount');
if (targetId === ctx.author.id) {
await ctx.reply('❌ You cannot pay yourself.');
return;
}
if (amount <= 0) {
await ctx.reply('❌ Amount must be positive.');
return;
}
const target = await mee6.getMember(targetId);
if (!target) {
await ctx.reply('❌ User not found.');
return;
}
if (target.bot) {
await ctx.reply('❌ You cannot pay bots.');
return;
}
const sender = mee6.store.member(ctx.author.id);
const senderBalance = await sender.get<number>('coins', 0);
if (senderBalance < amount) {
await ctx.reply(`❌ You only have **${senderBalance}** coins.`);
return;
}
await sender.incr('coins', -amount);
const receiver = mee6.store.member(targetId);
await receiver.incr('coins', amount);
await ctx.reply(`💸 You sent **${amount}** coins to ${target.mention}!`);
}
);
// /eco top - leaderboard
mee6.command('eco top', { description: 'Show the richest members' }, async (ctx) => {
const top = await mee6.store.memberTop('coins', 10);
if (top.length === 0) {
await ctx.reply('💰 No one has earned coins yet!');
return;
}
const lines = await Promise.all(
top.map(async (entry, i) => {
const member = await mee6.getMember(entry.user_id);
const name = member ? member.displayName : 'Unknown';
const medal = i === 0 ? '🥇' : i === 1 ? '🥈' : i === 2 ? '🥉' : `${i + 1}.`;
return `${medal} **${name}** — ${entry.value} coins`;
})
);
await ctx.reply({
embed: {
title: '💰 Richest Members',
description: lines.join('\n'),
color: '#f1c40f',
},
});
});
// /store list - show available roles
mee6.command('store list', { description: 'View roles available for purchase' }, async (ctx) => {
const items: { role: string | null; price: number; name: string }[] = [
{ role: ctx.settings.shop_role_1, price: ctx.settings.shop_price_1 ?? 500, name: 'Role 1' },
{ role: ctx.settings.shop_role_2, price: ctx.settings.shop_price_2 ?? 1000, name: 'Role 2' },
{ role: ctx.settings.shop_role_3, price: ctx.settings.shop_price_3 ?? 2000, name: 'Role 3' },
];
const available = items.filter((item) => item.role !== null);
if (available.length === 0) {
await ctx.reply('🏪 The shop is not configured yet. Ask an admin to set shop roles in the dashboard.');
return;
}
const lines = await Promise.all(
available.map(async (item) => {
const roles = await mee6.listRoles();
const role = roles.find((r) => r.id === item.role);
const roleName = role ? role.name : 'Unknown Role';
const hasRole = ctx.author.roles.includes(item.role!);
const status = hasRole ? '✅ Owned' : `💰 ${item.price} coins`;
return `**@${roleName}** — ${status}`;
})
);
const m = mee6.store.member(ctx.author.id);
const balance = await m.get<number>('coins', 0);
await ctx.reply({
embed: {
title: '🏪 Role Shop',
description: lines.join('\n'),
footer: { text: `Your balance: ${balance} coins` },
color: '#3498db',
},
});
});
// /store buy - purchase a role
mee6.command(
'store buy',
{
description: 'Buy a role from the shop',
options: [{ name: 'role', type: 'role', description: 'Role to purchase', required: true }],
},
async (ctx) => {
const roleId = ctx.option<string>('role');
// Check if role is in the shop
const items = [
{ role: ctx.settings.shop_role_1, price: ctx.settings.shop_price_1 ?? 500 },
{ role: ctx.settings.shop_role_2, price: ctx.settings.shop_price_2 ?? 1000 },
{ role: ctx.settings.shop_role_3, price: ctx.settings.shop_price_3 ?? 2000 },
];
const item = items.find((i) => i.role === roleId);
if (!item) {
await ctx.reply('❌ That role is not available in the shop.');
return;
}
// Check if user already has it
if (ctx.author.roles.includes(roleId)) {
await ctx.reply('❌ You already own this role.');
return;
}
// Check balance
const m = mee6.store.member(ctx.author.id);
const balance = await m.get<number>('coins', 0);
if (balance < item.price) {
await ctx.reply(`❌ You need **${item.price}** coins but only have **${balance}**.`);
return;
}
// Purchase
await m.incr('coins', -item.price);
await mee6.addRole(ctx.author.id, roleId);
const roles = await mee6.listRoles();
const role = roles.find((r) => r.id === roleId);
const roleName = role ? `@${role.name}` : 'the role';
await ctx.reply(`✅ You bought ${roleName} for **${item.price}** coins!`);
}
);