Members holding a role I choose in settings can run /payroll claim once a week to receive an amount of MEE6 coins set in settings, /payroll status shows when their next claim opens, and /payroll top shows who claimed the most this year
Members holding a specific role can claim MEE6 coins once per week. Track claim history and see yearly leaderboards.
Commands:
/payroll claim — Claim your weekly coins (7-day cooldown)/payroll status — Check when your next claim is ready/payroll top — See who claimed the most this yearSettings:
Made by MEE6. Remix it to get a copy of your own and change anything you like.
// Weekly Payroll — members with a specific role claim MEE6 coins weekly
mee6.settings({
eligible_role: {
type: 'role',
label: 'Payroll eligible role',
required: true,
sample: 'Employee',
},
amount: {
type: 'integer',
label: 'Coins per claim (1 to 1,000,000,000)',
default: 1000,
sample: 1000,
},
});
const WEEK_SECONDS = 7 * 24 * 60 * 60; // 7 days in seconds
const MAX_AMOUNT = 1_000_000_000; // what one call moves at most, the Economy plugin's own cap
mee6.command('payroll claim', { description: 'Claim your weekly payroll', ephemeral: true }, async (ctx) => {
const roleId = ctx.settings.eligible_role;
if (!roleId) {
await ctx.reply('⚠️ Payroll is not configured yet. An admin needs to set the eligible role in the dashboard.');
return;
}
// Check if member has the required role
if (!ctx.author.roles.includes(roleId)) {
await ctx.reply('❌ You do not have the required role to claim payroll.');
return;
}
const amount = ctx.settings.amount ?? 1000;
if (amount < 1 || amount > MAX_AMOUNT) {
const max = MAX_AMOUNT.toLocaleString('en-US');
await ctx.reply(`⚠️ The payroll must be between 1 and ${max} coins. An admin needs to change it in the dashboard.`);
return;
}
const m = mee6.store.member(ctx.author.id);
const lastClaim = await m.get<number>('last_payroll_claim', 0);
const now = Math.floor(Date.now() / 1000);
// Check if a week has passed
if (now - lastClaim < WEEK_SECONDS) {
const remaining = WEEK_SECONDS - (now - lastClaim);
const days = Math.floor(remaining / 86400);
const hours = Math.floor((remaining % 86400) / 3600);
const minutes = Math.floor((remaining % 3600) / 60);
await ctx.reply(`⏰ You can claim your next payroll in ${days}d ${hours}h ${minutes}m.`);
return;
}
// Grant the coins, raised by the server's Economy boosts like /work
const paid = await mee6.economy.add(ctx.author.id, amount, { boost: 'income' });
await m.set('last_payroll_claim', now);
// Track total claims this year
const year = new Date().getFullYear();
const yearKey = `claims_${year}`;
const yearClaims = await m.get<number>(yearKey, 0);
await m.set(yearKey, yearClaims + 1);
await ctx.reply(`✅ You claimed **${paid.amount} coins**! Your next claim is available in 7 days.`);
});
mee6.command(
'payroll status',
{ description: 'Check when your next payroll is available', ephemeral: true },
async (ctx) => {
const m = mee6.store.member(ctx.author.id);
const lastClaim = await m.get<number>('last_payroll_claim', 0);
if (lastClaim === 0) {
await ctx.reply('You have not claimed payroll yet. Use `/payroll claim` to get started!');
return;
}
const now = Math.floor(Date.now() / 1000);
const elapsed = now - lastClaim;
if (elapsed >= WEEK_SECONDS) {
await ctx.reply('✅ Your payroll is ready to claim! Use `/payroll claim`.');
} else {
const remaining = WEEK_SECONDS - elapsed;
const days = Math.floor(remaining / 86400);
const hours = Math.floor((remaining % 86400) / 3600);
const minutes = Math.floor((remaining % 3600) / 60);
await ctx.reply(`⏰ Your next payroll is available in ${days}d ${hours}h ${minutes}m.`);
}
}
);
mee6.command('payroll top', { description: 'See who claimed the most payrolls this year' }, async (ctx) => {
const year = new Date().getFullYear();
const yearKey = `claims_${year}`;
// Get top claimers for this year
const top = await mee6.store.memberTop(yearKey, 10);
if (top.length === 0) {
await ctx.reply(`No payroll claims yet in ${year}.`);
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';
return `${i + 1}. **${name}** — ${entry.value} claims`;
})
);
await ctx.reply({
embed: {
title: `💰 Top Payroll Claims ${year}`,
description: lines.join('\n'),
color: 0x43b581,
footer: { text: 'Most claims this year' },
},
});
});