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/_pick.js

javascript · 171 lines

Raw
1/**#command2name: /pick3answer: 4keyboard: 5parse_mode: markdown6aliases: 7allow_only_group: false8need_reply: false9is_web: 010#command**/11 12// ==========================================================13// 👑 GIFT AI — /pick14// RANDOM PICK COMMAND15// REPLIES DIRECTLY TO USER16// FAST + ACCURATE + ERROR-SAFE17// Usage: /pick Pizza, Burger, Rice18// ==========================================================19 20 21// ----------------------------------------------------------22// GET INPUT23// ----------------------------------------------------------24 25var input = String(params || "").trim();26 27 28// ----------------------------------------------------------29// GET MESSAGE ID30// ----------------------------------------------------------31 32var messageId = null;33 34if (request && request.message_id) {35  messageId = request.message_id;36}37 38 39// ----------------------------------------------------------40// HELPER — SEND REPLY41// ----------------------------------------------------------42 43function sendPickReply(text) {44 45  var data = {46    text: text,47    parse_mode: "HTML"48  };49 50  if (messageId) {51    data.reply_to_message_id = messageId;52  }53 54  Api.sendMessage(data);55}56 57 58// ----------------------------------------------------------59// CHECK INPUT60// ----------------------------------------------------------61 62if (!input) {63 64  sendPickReply(65    "🎯 <b>Gift's Pick</b>\n\n" +66    "Give me at least 2 options.\n\n" +67    "<b>Usage:</b>\n" +68    "/pick option1, option2, option3\n\n" +69    "<b>Example:</b>\n" +70    "/pick Pizza, Burger, Rice"71  );72 73  return;74}75 76 77// ----------------------------------------------------------78// SPLIT OPTIONS79// ----------------------------------------------------------80 81var choices = input.split(",");82var cleanChoices = [];83var seen = {};84 85 86// ----------------------------------------------------------87// CLEAN + VALIDATE + REMOVE DUPLICATES88// ----------------------------------------------------------89 90for (var i = 0; i < choices.length; i++) {91 92  var choice = String(choices[i] || "").trim();93 94  // Ignore empty options95  if (!choice) {96    continue;97  }98 99  // Limit excessively long options100  if (choice.length > 200) {101    choice = choice.substring(0, 200).trim();102  }103 104  // Case-insensitive duplicate detection105  var key = choice.toLowerCase();106 107  if (seen[key]) {108    continue;109  }110 111  seen[key] = true;112  cleanChoices.push(choice);113}114 115 116// ----------------------------------------------------------117// REQUIRE AT LEAST 2 UNIQUE OPTIONS118// ----------------------------------------------------------119 120if (cleanChoices.length < 2) {121 122  sendPickReply(123    "❌ <b>Not enough options.</b>\n\n" +124    "Give me at least 2 different choices.\n\n" +125    "<b>Example:</b>\n" +126    "/pick Yes, No"127  );128 129  return;130}131 132 133// ----------------------------------------------------------134// RANDOM SELECTION135// ----------------------------------------------------------136 137var randomIndex = Math.floor(138  Math.random() * cleanChoices.length139);140 141var picked = cleanChoices[randomIndex];142 143 144// ----------------------------------------------------------145// ESCAPE HTML146// ----------------------------------------------------------147 148function escapeHTML(text) {149 150  return String(text)151    .replace(/&/g, "&amp;")152    .replace(/</g, "&lt;")153    .replace(/>/g, "&gt;")154    .replace(/"/g, "&quot;")155    .replace(/'/g, "&#39;");156}157 158 159var safePicked = escapeHTML(picked);160 161 162// ----------------------------------------------------------163// SEND RESULT AS DIRECT REPLY164// ----------------------------------------------------------165 166sendPickReply(167  "🎯 <b>GIFT'S PICK</b>\n\n" +168  "I choose: <b>" +169  safePicked +170  "</b> 😌"171);