CREATORS/OnecreatorsbotPublic · Bot Template
AIThe bot manages a membership club called CREATORS. Users can apply for membership, view their status, and receive payment instructions. Administrators can approve or reject applications, set subscription prices, configure payment details, and review pending payments. The bot stores data in a database, sends notifications to users and admins, and handles payment receipts via photo or document uploads.
Commercemembershipsubscriptionpaymentsadmincreatortelegram
22 commands1 envUpdated 20d agoCreated Oct 6, 2026
commands/_searchuser.js
javascript · 118 lines
1/**#command2name: /searchuser3answer: 4keyboard: 5parse_mode: markdown6aliases: 7allow_only_group: false8need_reply: false9is_web: 010#command**/11 12 13const adminId = String(process.env.ADMIN_ID);14 15if (String(user.id) !== adminId) {16 await Api.sendMessage({17 chat_id: chat.id,18 text: "⛔️ این دستور فقط برای مدیر مجموعه است."19 });20 return;21}22 23const query = String(params || "").trim();24 25if (!/^\d+$/.test(query)) {26 await Api.sendMessage({27 chat_id: chat.id,28 text:29 "برای جستوجوی کاربر، شناسه تلگرام او را بعد از دستور بنویس:\n\n" +30 "/searchuser 1747493585"31 });32 return;33}34 35const targetUserId = Number(query);36 37const [38 name,39 username,40 membershipStatus,41 paymentStatus,42 plan,43 price,44 duration,45 subscriptionStart,46 subscriptionEnd,47 creatorId,48 pendingReceipt,49 archive50] = await Promise.all([51 db.user.get("profile_name", "", { user_id: targetUserId }),52 db.user.get("profile_username", "", { user_id: targetUserId }),53 db.user.get("membership_status", "ثبت نشده", { user_id: targetUserId }),54 db.user.get("payment_review_status", "ثبت نشده", { user_id: targetUserId }),55 db.user.get("selected_plan", "ثبت نشده", { user_id: targetUserId }),56 db.user.get("selected_plan_price", "0", { user_id: targetUserId }),57 db.user.get("selected_plan_duration", "0", { user_id: targetUserId }),58 db.user.get("subscription_start", "", { user_id: targetUserId }),59 db.user.get("subscription_end", "", { user_id: targetUserId }),60 db.user.get("creator_id", "", { user_id: targetUserId }),61 db.user.get("pending_payment_receipt", null, { user_id: targetUserId }),62 db.bot.get("creators_confirmed_payments", [])63]);64 65const payments = Array.isArray(archive)66 ? archive.filter(item => Number(item.user_id) === targetUserId)67 : [];68 69function formatDate(value) {70 if (!value) return "ثبت نشده";71 const date = new Date(value);72 if (Number.isNaN(date.getTime())) return String(value);73 return date.toLocaleString("fa-IR", {74 timeZone: "Asia/Tehran"75 });76}77 78const lines = [79 "🔎 پرونده کاربر",80 "━━━━━━━━━━━━━━━━━━",81 "🆔 شناسه تلگرام: " + targetUserId,82 "👤 نام: " + (name || "ثبت نشده"),83 "🔹 نام کاربری: " + (username || "ثبت نشده"),84 "",85 "👥 وضعیت عضویت: " + membershipStatus,86 "🪪 شناسه عضویت: " + (creatorId || "ثبت نشده"),87 "",88 "💳 وضعیت بررسی پرداخت: " + paymentStatus,89 "📦 طرح انتخابی: " + plan,90 "💰 مبلغ طرح: " + Number(price || 0).toLocaleString("en-US") + " تومان",91 "🗓 مدت اشتراک: " + (duration || "0") + " روز",92 "▶️ شروع اشتراک: " + formatDate(subscriptionStart),93 "⏹ پایان اشتراک: " + formatDate(subscriptionEnd),94 "",95 "📥 رسید در انتظار: " +96 (pendingReceipt && pendingReceipt.receipt_id97 ? pendingReceipt.receipt_id + " (" + (pendingReceipt.type || "نامشخص") + ")"98 : "موجود نیست"),99 "🗃 تعداد پرداختهای آرشیوشده: " + payments.length100];101 102for (const payment of payments.slice(0, 10)) {103 lines.push(104 "",105 "🧾 رسید: " + (payment.receipt_id || "نامشخص"),106 "💵 مبلغ پرداخت: " +107 Number(payment.price || 0).toLocaleString("en-US") + " تومان",108 "📌 وضعیت: " + (payment.status || "نامشخص"),109 "📅 زمان تأیید: " + formatDate(payment.approved_at),110 "📆 شروع: " + formatDate(payment.subscription_start),111 "📆 پایان: " + formatDate(payment.subscription_end)112 );113}114 115await Api.sendMessage({116 chat_id: chat.id,117 text: lines.join("\n")118});