CREATORS/OnecreatorsbotPublic · Bot Template

ProfileTelegram

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
Back to folder

commands/_Creatorid.js

javascript · 148 lines

Raw
1/**#command2name: /Creatorid3answer: 4keyboard: 5parse_mode: markdown6aliases: 7allow_only_group: false8need_reply: false9is_web: 010#command**/11 12if (String(user.id) !== String(process.env.ADMIN_ID)) {13  await Api.sendMessage({14    chat_id: chat.id,15    text: "⛔ دسترسی مجاز نیست."16  });17  return;18}19 20const targetId = Number(params.trim());21 22if (!Number.isInteger(targetId) || targetId <= 0) {23  await Api.sendMessage({24    chat_id: chat.id,25    text:26      "برای ساخت Creator ID، ابتدا Telegram ID را وارد کن.\n\n" +27      "مثال:\n" +28      "/creatorid 1747493585"29  });30  return;31}32 33 34// ─────────────────────────────35// بررسی Creator ID قبلی36// ─────────────────────────────37 38const existing = await db.user.get(39  "creator_id",40  null,41  { user_id: targetId }42);43 44if (existing) {45  await Api.sendMessage({46    chat_id: chat.id,47    text:48      "✦ این Creator قبلاً شناسه دارد.\n\n" +49      "Creator ID: " + existing50  });51  return;52}53 54 55// ─────────────────────────────56// ساخت شناسه تصادفی و یکتا57// ─────────────────────────────58 59let creatorId = null;60let attempts = 0;61 62while (!creatorId && attempts < 20) {63 64  attempts++;65 66  const code =67    Libs.random68      .randomString(6, {69        charset: "alphanumeric"70      })71      .toUpperCase();72 73  const candidate = "CREATOR-" + code;74 75  const ids = await Bot.getUsers();76 77  let duplicate = false;78 79  for (const id of ids) {80 81    const savedId = await db.user.get(82      "creator_id",83      null,84      { user_id: Number(id) }85    );86 87    if (savedId === candidate) {88      duplicate = true;89      break;90    }91  }92 93  if (!duplicate) {94    creatorId = candidate;95  }96}97 98 99// ─────────────────────────────100// اگر بعد از چند تلاش ساخته نشد101// ─────────────────────────────102 103if (!creatorId) {104 105  await Api.sendMessage({106    chat_id: chat.id,107    text:108      "⛔ در ساخت یک Creator ID یکتا مشکلی پیش آمد.\n\n" +109      "لطفاً دوباره تلاش کن."110  });111 112  return;113}114 115 116// ─────────────────────────────117// ذخیره Creator ID118// ─────────────────────────────119 120const saveUser = await db.user.set(121  "creator_id",122  creatorId,123  { user_id: targetId }124);125 126if (!saveUser.ok) {127 128  await Api.sendMessage({129    chat_id: chat.id,130    text:131      "⛔ خطا در ذخیره Creator ID."132  });133 134  return;135}136 137 138// ─────────────────────────────139// نتیجه140// ─────────────────────────────141 142await Api.sendMessage({143  chat_id: chat.id,144  text:145    "✦ Creator ID ساخته شد.\n\n" +146    "Telegram ID: " + targetId + "\n" +147    "Creator ID: " + creatorId148});