455 commands2 envUpdated 7h agoCreated Aug 26, 2026
commands/npcgo.js
javascript · 72 lines
1/**#command2name: npcgo3answer: 4keyboard: 5parse_mode: markdown6aliases: 7allow_only_group: false8need_reply: false9is_web: 010#command**/11 12/**#command13name: npcgo14answer: 15keyboard: 16parse_mode: markdown17aliases: 18allow_only_group: false19need_reply: false20is_web: 021#command**/22 23try {24try { Api.answerCallbackQuery({}); } catch (e0) {}25var uid = "";26if (typeof user !== "undefined" && user) {27 if (user.telegramid) uid = String(user.telegramid);28 else if (user.id) uid = String(user.id);29}30if (!uid) return;31var gift = await db.global.get("wal_gift_" + uid);32if (!gift) {33 await db.global.set("wal_gift_" + uid, "1");34 var c0 = parseInt(await db.global.get("wal_" + uid) || 0) || 0;35 await db.global.set("wal_" + uid, c0 + 10000);36}37var cost = 750;38var bal = parseInt(await db.global.get("wal_" + uid) || 0) || 0;39if (bal < cost) {40 Bot.sendMessage("موجودی کافی نیست. کیف: " + (bal / 100) + " ZC\nهر دست ۷.۵ ZC میخواهد.");41 return;42}43await db.global.set("wal_" + uid, bal - cost);44var you = 1 + Math.floor(Math.random() * 6);45var botn = 1 + Math.floor(Math.random() * 6);46var line = "🎲 تو: " + you + "\n🤖 ربات: " + botn + "\n";47var neu = bal - cost;48if (you > botn) {49 neu = neu + 1500;50 await db.global.set("wal_" + uid, neu);51 line = line + "\nبرد! +۷.۵ ZC";52} else if (you < botn) {53 await db.global.set("wal_" + uid, neu);54 line = line + "\nباخت. −۷.۵ ZC";55} else {56 neu = neu + cost;57 await db.global.set("wal_" + uid, neu);58 line = line + "\nمساوی. ۷.۵ ZC برگشت.";59}60line = line + "\n💎 موجودی: " + (neu / 100) + " ZC";61Api.sendMessage({62 text: line,63 reply_markup: {64 inline_keyboard: [65 [{ text: "🎲 دست بعد — ۷.۵ ZC", callback_data: "npcgo" }],66 [{ text: "🎮 بازیها", callback_data: "games" }]67 ]68 }69});70} catch (e) {71 Bot.sendMessage("خطا npcgo");72}