455 commands2 envUpdated 6h agoCreated Aug 26, 2026
commands/pet.js
javascript · 73 lines
1/**#command2name: pet3answer: 4keyboard: 5parse_mode: markdown6aliases: 7allow_only_group: false8need_reply: false9is_web: 010#command**/11 12/**#command13name: pet14answer: 15keyboard: 16parse_mode: 17aliases: 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;31 32var raw = String((await db.global.get("pet_" + uid)) || "");33if (!raw) {34 Api.sendMessage({35 text:36 "🐾 پت خونگی\n───────────────\n" +37 "هنوز پت نداری.\nقیمت خرید: ۵۰ ZC (گران و واقعی).\nغذا هر بار ۸ ZC.\nگرسنگی با زمان پایین میآید.",38 reply_markup: { inline_keyboard: [39 [{ text: "🛒 خرید پت ۵۰ ZC", callback_data: "petby" }],40 [{ text: "✨ پلاس", callback_data: "plus" }]41 ] }42 });43 return;44}45var p = {};46try { p = JSON.parse(raw); } catch (eP) { p = {}; }47var last = parseInt(p.last) || Date.now();48var hours = (Date.now() - last) / 3600000;49var hun = parseInt(p.hun) || 0;50hun = hun - Math.floor(hours * 6);51if (hun < 0) hun = 0;52p.hun = hun;53p.last = Date.now();54await db.global.set("pet_" + uid, JSON.stringify(p));55var mood = "شاد";56if (hun < 20) mood = "خسته / گرسنه";57else if (hun < 50) mood = "معمولی";58var card =59 "╭━━━━ ZORENIX PET ━━━━╮\n\n" +60 String(p.kind || "🐾") + " " + String(p.name || "Pet") + "\n" +61 "🍖 گرسنگی: " + hun + "/100\n" +62 "⭐ XP پت: " + (parseInt(p.xp) || 0) + "\n" +63 "💫 حال: " + mood + "\n" +64 "╰━━━━━━━━━━━━━━━━━━━━╯";65Api.sendMessage({66 text: card,67 reply_markup: { inline_keyboard: [68 [{ text: "🍖 غذا ۸ ZC", callback_data: "petfd" }, { text: "🎾 بازی ۲ ZC", callback_data: "petpl" }],69 [{ text: "✨ پلاس", callback_data: "plus" }]70 ] }71});72 73} catch (e) { Bot.sendMessage("خطا pet"); }