Skip to content

Instantly share code, notes, and snippets.

@KOULIKS94
Created March 20, 2025 16:53
Show Gist options
  • Select an option

  • Save KOULIKS94/b1cd2765f4b7f381aae8749d7fdd0003 to your computer and use it in GitHub Desktop.

Select an option

Save KOULIKS94/b1cd2765f4b7f381aae8749d7fdd0003 to your computer and use it in GitHub Desktop.
const userCoins = {};
const shopItems = { "VIP Role": 50, "Custom Name": 100 };
bot(
{
pattern: 'shop',
desc: 'View available shop items',
type: 'group',
},
async (message) => {
let shopList = '🛍️ *Group Shop*\n\n';
for (let [item, price] of Object.entries(shopItems)) {
shopList += `💰 *${item}* - ${price} Coins\n`;
}
await message.send(shopList);
}
);
bot(
{
pattern: 'buy ?(.*)',
desc: 'Buy an item from the shop',
type: 'group',
},
async (message, match) => {
const user = message.sender;
const itemPrice = shopItems[match];
if (!itemPrice) return await message.send('⚠️ Item not found! Use `!shop` to view items.');
if ((userCoins[user] || 0) < itemPrice) return await message.send('❌ Not enough coins!');
userCoins[user] -= itemPrice;
await message.send(`✅ You purchased *${match}*!`);
}
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment