Add /potion buy which spends 500 MEE6 coins on a potion, /potion drink which gives 200 XP and cannot be used twice in the same day, and /potion stock which shows how many potions a member holds
A potion economy system where members spend MEE6 coins to buy potions, then drink them for XP rewards. Each member can only drink one potion per day, creating a daily engagement loop. Use /potion buy to purchase for 500 coins, /potion drink to consume for 200 XP, and /potion stock to check your inventory.
Made by MEE6. Remix it to get a copy of your own and change anything you like.
🧪 Purchased 1 potion for 500 coins! You now have 1 potion.
🧪 You drank a potion and gained 200 XP! You have 0 potions left.
🎁 Daily reward claimed: +114 coins. You now have 134.
💼 You worked and earned 51 coins. You now have 185.
💼 You worked and earned 64 coins. You now have 249.
💼 You worked and earned 31 coins. You now have 280.
💼 You worked and earned 72 coins. You now have 352.
💼 You worked and earned 60 coins. You now have 412.
💼 You worked and earned 26 coins. You now have 438.
💼 You worked and earned 60 coins. You now have 498.
💼 You worked and earned 36 coins. You now have 534.
🧪 Purchased 1 potion for 500 coins! You now have 1 potion.
❌ You've already drunk a potion today. Come back tomorrow!
🧪 You drank a potion and gained 200 XP! You have 0 potions left. 🎉 Level up! You're now level 7!
// Potion System — buy potions with MEE6 coins, drink for XP (once per day)
mee6.command('potion buy', { description: 'Buy a potion for 500 coins' }, async (ctx) => {
const POTION_PRICE = 500;
// Check balance
const balance = await mee6.economy.balance(ctx.author.id);
if (balance.coins < POTION_PRICE) {
await ctx.reply(`❌ You need ${POTION_PRICE} coins but only have ${balance.coins}.`);
return;
}
// Deduct coins
await mee6.economy.remove(ctx.author.id, POTION_PRICE);
// Add potion to inventory
const m = mee6.store.member(ctx.author.id);
const stock = await m.get<number>('potions', 0);
await m.set('potions', stock + 1);
await ctx.reply(
`🧪 Purchased 1 potion for ${POTION_PRICE} coins! You now have ${stock + 1} potion${stock + 1 === 1 ? '' : 's'}.`
);
});
mee6.command('potion drink', { description: 'Drink a potion to gain 200 XP (once per day)' }, async (ctx) => {
const XP_REWARD = 200;
const m = mee6.store.member(ctx.author.id);
// Check if member has potions
const stock = await m.get<number>('potions', 0);
if (stock <= 0) {
await ctx.reply("❌ You don't have any potions. Use `/potion buy` to purchase one!");
return;
}
// Check daily cooldown
const lastDrink = await m.get<string>('last_drink', '');
const today = new Date().toISOString().split('T')[0]; // YYYY-MM-DD
if (lastDrink === today) {
await ctx.reply("❌ You've already drunk a potion today. Come back tomorrow!");
return;
}
// Consume potion
await m.set('potions', stock - 1);
await m.set('last_drink', today);
// Grant XP
const result = await mee6.xp.give(ctx.author.id, XP_REWARD);
let message = `🧪 You drank a potion and gained ${XP_REWARD} XP! You have ${stock - 1} potion${
stock - 1 === 1 ? '' : 's'
} left.`;
if (result.leveledUp) {
message += `\n🎉 **Level up!** You\'re now level ${result.level}!`;
}
await ctx.reply(message);
});
mee6.command('potion stock', { description: 'Check how many potions you have' }, async (ctx) => {
const m = mee6.store.member(ctx.author.id);
const stock = await m.get<number>('potions', 0);
const lastDrink = await m.get<string>('last_drink', '');
const today = new Date().toISOString().split('T')[0];
let message = `🧪 You have **${stock}** potion${stock === 1 ? '' : 's'}.`;
if (lastDrink === today) {
message += "\n⏰ You've already drunk a potion today. Come back tomorrow!";
} else if (stock > 0) {
message += '\n✅ You can drink a potion now with `/potion drink`!';
}
await ctx.reply(message);
});