millswelbeck148/SireimadeBotPublic · Bot Template

AISireImade appears to be a Telegram automation bot. Commands include /start, /about, /support, /id, /admin, /ban, /unban, /x. Observed in code: messaging, keyboards, games.

Utilityutility
ProfileTelegram
112 commands3 envUpdated 2h agoCreated Aug 27, 2026
Back to folder

commands/_legacy.js

javascript · 393 lines

Raw
1/**#command2name: /legacy3answer: 4keyboard: 5parse_mode: markdown6aliases: 7allow_only_group: false8need_reply: false9is_web: 010#command**/11 12// ==========================================================13// 🏆 GIFT AI — /LEGACY14//15// • /legacy16// • /legacy @username17// • Reply to a user with /legacy18// • Uses GIFT_USERS database19// • Calculates Legacy Score20// • Direct reply to /legacy command21// ==========================================================22 23 24// ==========================================================25// DATABASE26// ==========================================================27 28var users = Bot.getProperty("GIFT_USERS");29 30if (!Array.isArray(users)) {31  users = [];32}33 34 35// ==========================================================36// FIND TARGET37// ==========================================================38 39var target = null;40 41 42// ----------------------------------------------------------43// REPLY TARGET44// ----------------------------------------------------------45 46if (request.reply_to_message) {47 48  var replyUser =49    request.reply_to_message.from;50 51  var replyId =52    String(53      replyUser.telegramid ||54      replyUser.id55    );56 57  for (var i = 0; i < users.length; i++) {58 59    if (60      String(61        users[i].telegramid ||62        users[i].id63      ) === replyId64    ) {65 66      target = users[i];67      break;68 69    }70 71  }72 73}74 75 76// ----------------------------------------------------------77// USERNAME78// ----------------------------------------------------------79 80if (!target && params) {81 82  var username =83    params84      .trim()85      .replace(/^@/, "")86      .toLowerCase();87 88  for (var j = 0; j < users.length; j++) {89 90    var savedUsername =91      String(92        users[j].username || ""93      )94      .replace(/^@/, "")95      .toLowerCase();96 97    if (98      savedUsername === username99    ) {100 101      target = users[j];102      break;103 104    }105 106  }107 108}109 110 111// ----------------------------------------------------------112// COMMAND SENDER113// ----------------------------------------------------------114 115if (!target) {116 117  var uid =118    String(user.telegramid);119 120  for (var k = 0; k < users.length; k++) {121 122    if (123      String(124        users[k].telegramid ||125        users[k].id126      ) === uid127    ) {128 129      target = users[k];130      break;131 132    }133 134  }135 136}137 138 139// ==========================================================140// NOT FOUND141// ==========================================================142 143if (!target) {144 145  Api.sendMessage({146 147    chat_id: chat.id,148 149    text:150      "🏆 <b>LEGACY FAILED</b>\n\n" +151      "Gift doesn't have enough history on this person yet.\n\n" +152      "Let them interact with Gift first. 💀",153 154    parse_mode: "HTML",155 156    reply_to_message_id:157      request.message_id158 159  });160 161  return;162}163 164 165// ==========================================================166// DATA167// ==========================================================168 169var name =170  target.first_name ||171  target.username ||172  "Unknown";173 174var username =175  target.username176    ? "@" +177      String(target.username)178        .replace(/^@/, "")179    : "No username";180 181var messages =182  Number(target.messages || 0);183 184var chats =185  Array.isArray(target.chats)186    ? target.chats.length187    : 0;188 189 190// ==========================================================191// TIME KNOWN192// ==========================================================193 194var now =195  new Date().getTime();196 197var firstSeen =198  Number(target.first_seen || now);199 200var daysKnown =201  Math.floor(202    (now - firstSeen) /203    86400000204  );205 206if (daysKnown < 0) {207  daysKnown = 0;208}209 210 211// ==========================================================212// LEGACY SCORE213// ==========================================================214//215// Message contribution216// Longevity contribution217// Chat contribution218//219// Score is capped at 100000.220// ==========================================================221 222var messageScore =223  Math.min(224    messages * 2,225    60000226  );227 228var longevityScore =229  Math.min(230    daysKnown * 100,231    25000232  );233 234var chatScore =235  Math.min(236    chats * 1000,237    15000238  );239 240 241var legacyScore =242  messageScore +243  longevityScore +244  chatScore;245 246 247legacyScore =248  Math.min(249    Math.round(legacyScore),250    100000251  );252 253 254// ==========================================================255// LEGACY RANK256// ==========================================================257 258var rank;259var emoji;260 261if (legacyScore >= 90000) {262 263  rank = "MYTHIC";264  emoji = "🌌";265 266} else if (legacyScore >= 70000) {267 268  rank = "LEGENDARY";269  emoji = "👑";270 271} else if (legacyScore >= 50000) {272 273  rank = "ELITE";274  emoji = "💎";275 276} else if (legacyScore >= 30000) {277 278  rank = "VETERAN";279  emoji = "⚔️";280 281} else if (legacyScore >= 15000) {282 283  rank = "NOTABLE";284  emoji = "🔥";285 286} else if (legacyScore >= 5000) {287 288  rank = "KNOWN";289  emoji = "⭐";290 291} else {292 293  rank = "NPC";294  emoji = "👤";295 296}297 298 299// ==========================================================300// LEGACY TITLES301// ==========================================================302 303var titles = {304 305  "MYTHIC":306    "The group remembers you even when you're gone.",307 308  "LEGENDARY":309    "You've officially become part of the group's history.",310 311  "ELITE":312    "Your presence has left serious fingerprints.",313 314  "VETERAN":315    "You've survived enough group chaos to earn respect.",316 317  "NOTABLE":318    "People have definitely noticed you.",319 320  "KNOWN":321    "You're no longer a stranger around here.",322 323  "NPC":324    "Your story has barely started."325};326 327 328var title =329  titles[rank];330 331 332// ==========================================================333// LEGACY REPORT334// ==========================================================335 336var text =337 338  "🏆 <b>GIFT LEGACY CARD</b>\n\n" +339 340  "👤 <b>" +341  name +342  "</b>\n" +343 344  "🔖 " +345  username +346  "\n\n" +347 348  emoji +349  " <b>" +350  rank +351  "</b>\n\n" +352 353  "📊 Legacy Score: <b>" +354  legacyScore +355  "/100000</b>\n\n" +356 357  "📨 Messages: <b>" +358  messages +359  "</b>\n" +360 361  "💬 Chats recorded: <b>" +362  chats +363  "</b>\n" +364 365  "⏳ Known for: <b>" +366  daysKnown +367  " days</b>\n\n" +368 369  "📜 <b>Legacy:</b>\n" +370  "<i>" +371  title +372  "</i>\n\n" +373 374  "💜 <b>Gift says:</b>\n" +375  "<i>The database remembers everything.</i>";376 377 378// ==========================================================379// DIRECT REPLY380// ==========================================================381 382Api.sendMessage({383 384  chat_id: chat.id,385 386  text: text,387 388  parse_mode: "HTML",389 390  reply_to_message_id:391    request.message_id392 393});