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
112 commands3 envUpdated 1h agoCreated Aug 27, 2026
commands/_ghost.js
javascript · 359 lines
1/**#command2name: /ghost3answer: 4keyboard: 5parse_mode: markdown6aliases: 7allow_only_group: false8need_reply: false9is_web: 010#command**/11 12// ==========================================================13// 👻 GIFT AI — /GHOST14//15// • /ghost16// • /ghost 3017// • Uses GIFT_USERS_DATABASE18// • Finds inactive users19// • Default inactivity: 7 days20// • Maximum: 365 days21// • Direct reply to command22// ==========================================================23 24 25// ==========================================================26// ONLY GROUPS27// ==========================================================28 29if (30 chat.type !== "group" &&31 chat.type !== "supergroup"32) {33 34 Api.sendMessage({35 36 chat_id: chat.id,37 38 text:39 "👻 <b>GHOST</b>\n\n" +40 "This command only works inside groups.",41 42 parse_mode: "HTML",43 44 reply_to_message_id:45 request.message_id46 47 });48 49 return;50 51}52 53 54// ==========================================================55// GET USER DATABASE56// ==========================================================57 58var users =59 Bot.getProperty(60 "GIFT_USERS_DATABASE"61 );62 63 64if (!Array.isArray(users)) {65 users = [];66}67 68 69// ==========================================================70// DAYS FILTER71// ==========================================================72 73var days =74 parseInt(75 (params || "").trim()76 );77 78 79if (80 isNaN(days) ||81 days <= 082) {83 84 days = 7;85 86}87 88 89// Maximum 365 days90if (days > 365) {91 days = 365;92}93 94 95// ==========================================================96// CURRENT TIME97// ==========================================================98 99var now =100 new Date().getTime();101 102var cutoff =103 now -104 (105 days *106 24 *107 60 *108 60 *109 1000110 );111 112 113// ==========================================================114// FIND GHOSTS115// ==========================================================116 117var ghosts = [];118 119 120for (121 var i = 0;122 i < users.length;123 i++124) {125 126 var saved =127 users[i];128 129 130 if (131 !saved.last_seen132 ) {133 134 continue;135 136 }137 138 139 var lastSeen =140 new Date(141 saved.last_seen142 ).getTime();143 144 145 if (146 isNaN(lastSeen)147 ) {148 149 continue;150 151 }152 153 154 if (155 lastSeen <= cutoff156 ) {157 158 ghosts.push(159 saved160 );161 162 }163 164}165 166 167// ==========================================================168// SORT169// OLDEST ACTIVITY FIRST170// ==========================================================171 172ghosts.sort(173 function(a, b) {174 175 return new Date(176 a.last_seen177 ).getTime()178 179 -180 181 new Date(182 b.last_seen183 ).getTime();184 185 }186);187 188 189// ==========================================================190// LIMIT RESULTS191// ==========================================================192 193var shown =194 ghosts.slice(0, 20);195 196 197// ==========================================================198// NO GHOSTS199// ==========================================================200 201if (202 shown.length === 0203) {204 205 Api.sendMessage({206 207 chat_id: chat.id,208 209 text:210 "👻 <b>GHOST SCAN</b>\n\n" +211 212 "No ghosts found after <b>" +213 days +214 " days</b> of inactivity.\n\n" +215 216 "💜 Everyone is still alive... for now.",217 218 parse_mode: "HTML",219 220 reply_to_message_id:221 request.message_id222 223 });224 225 return;226 227}228 229 230// ==========================================================231// BUILD REPORT232// ==========================================================233 234var text =235 "👻 <b>GIFT'S GHOST LIST</b>\n\n" +236 237 "People not seen by Gift for " +238 239 "<b>" +240 days +241 "+ days</b>:\n\n";242 243 244for (245 var g = 0;246 g < shown.length;247 g++248) {249 250 var ghost =251 shown[g];252 253 254 var ghostName =255 ghost.first_name ||256 ghost.username ||257 "Unknown";258 259 260 var ghostUsername =261 ghost.username262 ? "@" +263 String(264 ghost.username265 ).replace(/^@/, "")266 : "";267 268 269 var ghostMessages =270 Number(271 ghost.messages ||272 ghost.interactions ||273 0274 );275 276 277 var last =278 new Date(279 ghost.last_seen280 );281 282 283 var lastDate =284 last.toLocaleDateString();285 286 287 var inactiveDays =288 Math.floor(289 (290 now -291 last.getTime()292 ) /293 (294 24 *295 60 *296 60 *297 1000298 )299 );300 301 302 text +=303 304 "👻 <b>" +305 ghostName +306 "</b>\n" +307 308 (309 ghostUsername310 ? "🔖 " +311 ghostUsername +312 "\n"313 : ""314 ) +315 316 "📨 Messages: <b>" +317 ghostMessages +318 "</b>\n" +319 320 "🕐 Last seen: <b>" +321 lastDate +322 "</b>\n" +323 324 "🌫️ Gone for: <b>" +325 inactiveDays +326 " days</b>\n\n";327 328}329 330 331// ==========================================================332// FOOTER333// ==========================================================334 335text +=336 337 "👻 Total ghosts found: <b>" +338 ghosts.length +339 "</b>\n\n" +340 341 "💀 <i>They left the group without leaving the database.</i>";342 343 344// ==========================================================345// DIRECT REPLY346// ==========================================================347 348Api.sendMessage({349 350 chat_id: chat.id,351 352 text: text,353 354 parse_mode: "HTML",355 356 reply_to_message_id:357 request.message_id358 359});