bkjioapk/IDBotRiom_botPublic · Bot Template
AIThis bot helps users find Telegram IDs of users, groups, channels, and bots. It provides commands to get your own ID via /me or inline queries, share chats or users for ID retrieval with /start and the wildcard handler, and includes helpful options like copy buttons and direct chat links. The bot uses TBL APIs such as Bot, Api, and user data to handle messages and inline queries securely.
Utilitytelegram idsid finderinline querychat shareutility botuser id
6 commands0 envUpdated 7d agoCreated Aug 31, 2026
commands/_.js
javascript · 133 lines
1/**#command2name: *3answer: 4keyboard: 5parse_mode: 6aliases: 7allow_only_group: false8need_reply: false9is_web: 010#command**/11 12function makeKeyboard(id) {13 14 let linkBtns = [15 [{16 text: "Copy ID",17 copy_text: {18 text: id19 }20 }]21 ]22 23 24 //handling channel links25 if (id.toString().startsWith("-100")) {26 let spit_id = id.toString().replace("-100", "")27 //https://t.me/c/2440965237/1000000028 let btns = [{29 text: "Open Chat",30 url: "https://t.me/c/" + spit_id + "/10000000"31 }]32 linkBtns.push(btns)33 } else {34 // For users35 // for Android: tg://openmessage?user_id=7400xxxxxx36 // for iOS: https://t.me/@id7400xxxxxx37 let btns = [{38 text: "Android",39 url: `tg://openmessage?user_id=${id}`40 },41 {42 text: "iOS",43 url: `https://t.me/@id${id}`44 }45 ]46 linkBtns.push(btns)47 }48 return linkBtns49}50 51function send(text, id) {52 Api.sendMessage({53 text,54 parse_mode: "HTML",55 reply_markup: {56 inline_keyboard: makeKeyboard(id)57 }58 });59}60 61if (update.message) {62 if (update.message.chat_shared) {63 const {64 chat_id,65 title,66 username67 } = update.message.chat_shared;68 if (chat_id) {69 const chatName = title || username || "this chat";70 const message = `🪪 The ID of <b>${chatName}</b> is: <code>${chat_id}</code>`;71 send(message, chat_id);72 }73 }74 75 if (update.message.users_shared) {76 const {77 users78 } = update.message.users_shared;79 let message = "";80 81 users.forEach(user => {82 const {83 user_id,84 first_name,85 last_name86 } = user;87 if (user_id) {88 const fullName = [first_name, last_name].filter(Boolean).join(' ');89 const userName = fullName || `user ${user_id}`;90 message += `🪪 The ID of <b>${userName}</b> is: <code>${user_id}</code>\n`;91 // Send message for each user to have proper button92 const userMessage = `🪪 The ID of <b>${userName}</b> is: <code>${user_id}</code>`;93 send(userMessage, user_id);94 }95 });96 97 if (message && users.length === 0) {98 // Fallback if users array is empty but we have user_id in user_shared99 return;100 }101 return;102 }103 104 if (update.message.user_shared) {105 const {106 user_id107 } = update.message.user_shared;108 if (user_id) {109 const userName = `user ${user_id}`;110 const message = `🪪 The ID of <b>${userName}</b> is: <code>${user_id}</code>`;111 send(message, user_id);112 }113 }114 115 if (update.message.forward_from) {116 const fwd = update.message.forward_from;117 if (fwd && fwd.id) {118 const fullName = [fwd.first_name, fwd.last_name].filter(Boolean).join(' ');119 const userName = fullName || fwd.username || "forwarded user";120 const message = `🪪 The ID of <b>${userName}</b> is: <code>${fwd.id}</code>`;121 send(message, fwd.id);122 }123 }124 125 if (update.message.forward_from_chat) {126 const chat = update.message.forward_from_chat;127 if (chat && chat.id) {128 const chatName = chat.title || chat.username || "forwarded chat";129 const message = `🪪 The ID of <b>${chatName}</b> is: <code>${chat.id}</code>`;130 send(message, chat.id);131 }132 }133}