fa
Feedback

فریب کلاهبرداران را نخورید! تل‌متریو این کانال‌ها را شناسایی و برچسب‌گذاری می‌کند 👉 برای مشاهده برچسب، اشتراک تهیه کنید 👈

TBL Codes

TBL Codes

رفتن به کانال در Telegram

نمایش بیشتر
کشور مشخص نشده استفناوری و برنامه‌ها54 965
311
مشترکین
اطلاعاتی وجود ندارد24 ساعت
+27 روز
+330 روز
آرشیو پست ها
Repost from TeleBotHost
🚀 Promote Your Brand Across TeleBotHost Get your brand, product, service, or app in front of Telegram users through ads displayed across TeleBotHost-powered bots. 📊 Simple CPM pricing Pay based on every 1,000 ad impressions. 🔥 Ready to promote? DM @onDNDbro for current rates, campaign details, and availability. 💳 Crypto payments only ⚠️ No adult/18+ ads are accepted at this time. (Will be accepted later) Get your brand seen. Start your campaign today. CPM is low now, so grab it fast; it will increase later.

Demo TBH code to get user info with profile pic (Guest Message + Rich Message. Code:
// Command: * or /handle_guest_message 

if (!update.guest_message) return

let msg = update.guest_message
let userText = msg.text || ""

if (!msg.text) return

// User info from global `user` object
let fullName = user.full_name || user.first_name || "User"
let userId = user.id || "Unknown"
let username = user.username ? "@" + user.username : "Not set"
let language = user.language_code || "Unknown"
let isBot = user.is_bot ? "Yes" : "No"
let isPremium = user.is_premium ? "✅ Yes" : "❌ No"

// Fetch profile photos
let photoFileIds = []
let mediaItems = []
let photoHtml = ""

try {
  let photos = await Api.getUserProfilePhotos({
    user_id: userId,
    limit: 50
  })
  
  if (photos.ok && photos.result && photos.result.photos && photos.result.photos.length > 0) {
    let allPhotos = photos.result.photos
    let maxPhotos = Math.min(allPhotos.length, 50)
    
    for (let i = 0; i < maxPhotos; i++) {
      let photo = allPhotos[i]
      if (photo && photo.length > 0) {
        let fileId = photo[photo.length - 1].file_id
        let mediaId = "photo_" + i
        photoFileIds.push(fileId)
        
        mediaItems.push({
          id: mediaId,
          media: {
            type: "photo",
            media: fileId
          }
        })
      }
    }
    
    if (photoFileIds.length > 0) {
      let slideshowImages = photoFileIds.map(function(id, index) {
        return '<img src="tg://photo?id=photo_' + index + '"/>'
      }).join('\n  ')
      
      let captionText = photoFileIds.length === 1 
        ? "📸 1 profile photo" 
        : "📸 " + photoFileIds.length + " profile photos"
      
      photoHtml = `
<tg-slideshow>
  ${slideshowImages}
  <figcaption>${captionText}</figcaption>
</tg-slideshow>
`
    }
  }
} catch (e) {
  photoHtml = `<p><i>Could not fetch profile photos</i></p>`
}

if (!photoFileIds.length) {
  photoHtml = `<p><i>No profile photos found</i></p>`
}

// Build rich message
let profileHtml = `
<details>
<summary><b>👤 User Info — ${fullName}</b></summary>

<h2>Basic Info</h2>
<ul>
  <li><b>ID:</b> <code>${userId}</code></li>
  <li><b>Name:</b> ${fullName}</li>
  <li><b>Username:</b> ${username}</li>
  <li><b>Language:</b> ${language}</li>
</ul>

<h2>Status</h2>
<ul>
  <li><b>Bot:</b> <code>${isBot}</code></li>
  <li><b>Premium:</b> <code>${isPremium}</code></li>
</ul>

${photoHtml}

</details>
`

let richMessage = {
  html: profileHtml
}

if (mediaItems.length > 0) {
  richMessage.media = mediaItems
}

await Api.call("answerGuestQuery", {
  guest_query_id: msg.guest_query_id,
  result: JSON.stringify({
    type: "article",
    id: String(Date.now()),
    title: "👤 User Info",
    input_message_content: {
      rich_message: richMessage
    }
  })
})

Demo TBH code for the new Bot API update ephemeral message. Code: /* Command: /ephemeral */ // Get target user and chat info
Demo TBH code for the new Bot API update ephemeral message. Code:
/* Command: /ephemeral */

// Get target user and chat info
let targetUserId = user.id;
let groupId = chat.id;
let userName = user.first_name || "User";

// 1. Send Ephemeral Text Message
await Api.sendMessage({
  chat_id: groupId,
  text: "🎯 This message is only visible to you, " + userName + "!",
  receiver_user_id: targetUserId,
  parse_mode: "HTML"
});

// 2. Send Ephemeral Photo
await Api.sendPhoto({
  chat_id: groupId,
  photo: "https://telegram.org/img/t_logo.png",
  caption: "📸 <b>Private Photo</b>\n\nOnly you can see this!",
  receiver_user_id: targetUserId,
  parse_mode: "HTML"
});

// 3. Send Ephemeral Sticker
await Api.sendSticker({
  chat_id: groupId,
  sticker: "CAACAgIAAxkBAAIxM2pbn6j6YZCWRUsSdh6sen7nBmJbAAL8HgACuNHQSheZ4BUjnIebPQQ",
  receiver_user_id: targetUserId
});
For more explore new update!

Official broadcast codes

Repost from xCode
TBH Helper Ai was deleted on ChatGPT but don't worry we came with new TBH Helper Ai on Gemini - Try it and build your bots on telebothost.com - https://gemini.google.com/gem/1j_DmyTdxpxuBgtEJBOLVcCGumvVw5XmM?usp=sharing
TBH Helper Ai is a Expert: • TeleBot Lang (TBL)  • trained on TBH Docs docs.telebothost.com
More updates, features & tools coming soon. it may do soe mistakes so give feedback so we can improve and do fixes #Telegram #TelegramBots #ChatGPT #Programming #Developers

Groq Ai TBL Code Example of using Groq ai models in TBH Command: * TBL Code:
const GROQ_API_KEY =
  "Api_Key"

const MODEL =
  "llama-3.1-8b-instant"

const TOKEN = bot.token

async function editInline(id, text) {

  return await HTTP.post({
    url:
      "https://api.telegram.org/bot" +
      TOKEN +
      "/editMessageText",

    body: {
      inline_message_id: id,
      text: text
    }
  })

}

if (update.chosen_inline_result) {

  try {

    let query =
      update.chosen_inline_result.query

    let inlineMessageId =
      update.chosen_inline_result.inline_message_id

    if (!query || !inlineMessageId)
      return

    await editInline(
      inlineMessageId,
      "Thinking..."
    )

    let ai = await HTTP.post({

      url:
        "https://api.groq.com/openai/v1/chat/completions",

      headers: {
        Authorization:
          "Bearer " +
          GROQ_API_KEY
      },

      body: {
        model: MODEL,

        messages: [
          {
            role: "user",
            content: query
          }
        ]
      }

    })

    let reply =
      ai.data.choices[0].message.content

    await editInline(
      inlineMessageId,
      reply || "No response"
    )

  } catch (e) {

    await editInline(
      update.chosen_inline_result
        .inline_message_id,
      "API Error"
    )

  }

}
Command: /inline_query TBL Code:
try {

  let query = request.query

  if (!query || query.trim() === "") {

    return await Api.answerInlineQuery({
      inline_query_id: request.id,
      results: [],
      cache_time: 1
    })

  }

  query = query.slice(0, 256)

  await Api.answerInlineQuery({

    inline_query_id: request.id,

    cache_time: 1,

    is_personal: true,

    results: [
      {
        type: "article",

        id: String(Date.now()),

        title: "Ask AI",

        description: query,

        input_message_content: {
          message_text: "Thinking... ▌"
        },

        reply_markup: {
          inline_keyboard: [
            [
              {
                text: "⬤",
                callback_data: "loading"
              }
            ]
          ]
        }

      }
    ]

  })

} catch (e) {}
use groq/compound or groq/compound-mini ai model for real time info Get a free api key from https://console.groq.com/keys Example by: @CyberXCoding

/* Command: * */

if(!update.guest_message){ return }

let guest = update.guest_message
let text = (guest.text || "").toLowerCase()

let target = guest.from
let message = "@Durov"

// !info trigger
if(text.includes("!info")){

  // replied user info
  if(guest.reply_to_message){
    let replied = guest.reply_to_message
    if(replied.guest_bot_caller_user){
      target = replied.guest_bot_caller_user
    }else if(replied.from){
      target = replied.from
    }
  }

  let name = target.first_name || "—"
  let username = target.username
    ? "@" + target.username
    : "—"

  let userid = target.id || "—"

  message =
`👤 ${name}
🆔 ${userid}
🔗 ${username}`
}

// guest reply
Api.call("answerGuestQuery", {
  guest_query_id: guest.guest_query_id,
  result: {
    type: "article",
    id: "reply",
    title: "Reply",
    description: "@Durov",
    input_message_content: {
      message_text: message
    }
  }
})
🔥 Tbl guest mode example code. Use query !info to get your or others info.

Repost from xCode
Pinterest Image Search TBL Code Api - https://pinterest-api-bay.vercel.app/example/docs Command - /search Wait for answer: On ✅ TBL -
let query = message

if (!query) {
  Bot.sendMessage("Please enter a search query.")
  return
}

User.set("q", query, "string")

let res = await HTTP.post({
  url: "https://pinterest-api-bay.vercel.app/v5/pins/search",
  body: {
    query: query,
    count: 10,
    compact: true
  }
})

if (!res.ok) {
  Bot.sendMessage("Request failed. Please try again later.")
  return
}

let data

try {
  data = res.data
} catch (e) {
  Bot.sendMessage("Failed to parse response.")
  return
}

if (!data.items || data.items.length === 0) {
  Bot.sendMessage("No results found.")
  return
}

let savedQuery = User.get("q") || "Result"
let botName = bot.name

for (let i = 0; i < data.items.length; i++) {
  let item = data.items[i]

  let title = item.title ? item.title : savedQuery
  let image = item.image
  let link = item.url ? item.url : ""

  let buttons = []

  if (link) {
    buttons.push([{ text: "View on Pinterest", url: link }])
  }

  buttons.push([{ text: "Copy Image URL", copy_text: { text: image } }])

  let caption =
    "<b>" + title + "</b>\n" +
    "<i>Query:</i> " + savedQuery + "\n" +
    "<i>Searched by:</i> @" + botName

  await Api.sendPhoto({
    chat_id: user.telegramid,
    photo: image,
    caption: caption,
    parse_mode: "HTML",
    disable_web_page_preview: true,
    reply_markup: {
      inline_keyboard: buttons
    }
  })
}
Developer: @CyberXCoding platform: telebothost.com

const ADMIN_ID = 5723455420;

function getOriginalUserIdByMessageId(messageId) {
  let hiddenUserId = Bot.get("pvt" + messageId);
  return hiddenUserId;
}

if(!msg) return;
if(chat.type != "private") return;
// to ensure that it's a message update and private chat

//forward any message from user to admin
if(chat.id != ADMIN_ID) {
  let forwardResult = await Api.forwardMessage({
    chat_id: ADMIN_ID,
    from_chat_id: chat.id,
    message_id: msg.message_id //msg is update.message
  });
  
  if(forwardResult?.result?.forward_origin?.type == "hidden_user") {
    // Logic: When user has privacy mode enabled (hidden_user), 
    // store mapping between forwarded message ID and original user ID
    // This allows admin to reply to hidden users by referencing the stored ID
    Bot.set("pvt" + forwardResult?.result?.message_id, user.id);
  }
  
  msg.reply("*✅ Message successfully sent to Admin*");
}

if(chat.id == ADMIN_ID && request?.reply_to_message) {
  
  // if admin reply to forwarded message, send copy to user
  let originalChatId = request.reply_to_message?.forward_from?.id || 
                       getOriginalUserIdByMessageId(request.reply_to_message.message_id);
  
  Api.copyMessage({
    chat_id: originalChatId,
    from_chat_id: ADMIN_ID,
    message_id: msg.message_id
  });
}
Updated, Added fallback logic to handle hidden_user (forward messages show disable)

let res = await HTTP.get(
  "https://telebothost.com/logo.png",
  {
    headers: {
      "x-response-type": "buffer"
    }
  }
);

const buffer = res.data;

Api.setChatPhoto({
  photo: buffer,
});
This is how you can set Profile photo of a group with TBL And this same way you can use this trick on method that need inputFile

Repost from BIZ FACTORY
🧠 Smart Telegram Auto Caption Bot for TeleBotHost (TBH) Command: * TBL Code: function escapeHTML(text){ if(!text) return "";
🧠 Smart Telegram Auto Caption Bot for TeleBotHost (TBH) Command: * TBL Code:
function escapeHTML(text){
  if(!text) return "";
  return text
    .replace(/&/g, "&amp;")
    .replace(/</g, "&lt;")
    .replace(/>/g, "&gt;");
}

let post = request;

if(!post || !post.message_id) return;
if(post.chat.type !== "channel") return;

let footer =
"\n\n━━━━━━━━━━━━━━\n" +
"📢 <b>Follow us for more updates!</b>\n" +
"🔗 <a href='https://t.me/bizft'>Join our channel</a>";

let checkText = (post.caption || post.text || "");
if(checkText.includes("Join our channel")) return;

if(post.photo || post.video || post.document || post.audio){

  let baseCaption = escapeHTML(post.caption ? post.caption.trim() : "");
  let finalCaption = baseCaption ? (baseCaption + footer) : footer.trim();

  if(finalCaption.length > 1024){
    finalCaption = finalCaption.substring(0, 900) + "..." + footer;
  }

  Api.editMessageCaption({
    chat_id: post.chat.id,
    message_id: post.message_id,
    caption: finalCaption,
    parse_mode: "HTML"
  });

  return;
}

if(post.text){

  let baseText = escapeHTML(post.text.trim());
  let finalText = baseText + footer;

  Api.editMessageText({
    chat_id: post.chat.id,
    message_id: post.message_id,
    text: finalText,
    parse_mode: "HTML",
    disable_web_page_preview: true
  });

  return;
}
Setup Guide:
1️⃣ Create Your Bot: · Go to telebothost.com and create your bot
2️⃣ Add Command: · Create a new command * (wildcard) · Paste the above code into the command
3️⃣ Deploy & Test: · Deploy your bot · Send your chosen command to get a random quiz! ✅
🧠Made BY @bizft

// custom emoji ID
const EMOJI_ID = "5474667187258006816"

Api.sendMessage({
  text: "<b>🔥 New Button UI</b>\n\nInline + Keyboard colors & icons",
  parse_mode: "HTML",
  reply_markup: {
    inline_keyboard: [

      // Row 1
      [
        { text: "Normal", callback_data: "*" },
        { text: "Primary", callback_data: "*", style: "primary" }
      ],

      // Row 2
      [
        { text: "Success", callback_data: "*", style: "success" },
        { text: "Danger", callback_data: "*", style: "danger" }
      ],

      // Row 3 (Icon)
      [
        {
          text: "Icon Button",
          callback_data: "*",
          icon_custom_emoji_id: EMOJI_ID
        }
      ]
    ]
  }
})


// ---------- KEYBOARD ----------

Api.sendMessage({
  chat_id: chat.id,
  text: "⌨️ Keyboard Button Test",
  reply_markup: {
    keyboard: [

      [
        { text: "Normal KB" },
        { text: "Primary KB", style: "primary" }
      ],

      [
        { text: "Success KB", style: "success" },
        { text: "Danger KB", style: "danger" }
      ],

      [
        {
          text: "Icon KB",
          icon_custom_emoji_id: EMOJI_ID
        }
      ]
    ],
    resize_keyboard: true
  }
})
Exclusive TBH (TBL) Code To Send Colored Button & Emoji Icon Button By @Paradox0x0 Note: Custom icon only works if bot owner has telegram premium

Custom emoji formatter Automatically detects Telegram custom emojis in user messages and converts them into safe tg://emoji?id= references, wrapped in code format. Works with any text length and preserves original messages. Like @AdsMarkdownBot Code :
/**
command: * 
need_reply: false 
*/

if (!msg || !msg.text) return;
if(chat.type != "private") return;

function escapeHTML(t) {
  return t
    .replace(/&/g, "&amp;")
    .replace(/</g, "&lt;")
    .replace(/>/g, "&gt;");
}

let text = msg.text;
let entities = msg.entities || [];

let result = "";
let lastIndex = 0;
let hasCustomEmoji = false;

for (let i = 0; i < entities.length; i++) {
  let e = entities[i];

  if (e.type == "custom_emoji") {
    hasCustomEmoji = true;
    result += text.slice(lastIndex, e.offset);

    let emojiChar = text.substr(e.offset, e.length);
    result += "!["
      + emojiChar
      + "](tg://emoji?id="
      + e.custom_emoji_id
      + ")";

    lastIndex = e.offset + e.length;
  }
}

result += text.slice(lastIndex);

let out = hasCustomEmoji ? result : text;
out = escapeHTML(out);
out = "<code>" + out + "</code>";

let max = 3800;
for (let i = 0; i < out.length; i += max) {
  Api.sendMessage({
    chat_id: chat.id,
    text: out.slice(i, i + max),
    parse_mode: "HTML"
  });
}
🚀 Getting Started is Simple!  1️⃣ Sign up / Log in at https://telebothost.com/  2️⃣ Add your first bot – don’t forget to read the guide 3️⃣ Paste the codes and begin your adventure Share your bot and codes with us to be part of our journey 🤝 Don’t forget to share this with your friends

❔ Code to get premium/custom emoji ids: 📘 Command: /emojiid
// /emojiid command handler
if (!params) {
  Api.sendMessage({
    text: "❗ <b>Usage</b>:\n<code>/emojiid &lt;message with premium emoji&gt;</code>",
    parse_mode: "HTML"
  });
  return;
}

let text = "❌ No premium/custom emojis found.";

// Check entities
if (request.entities && Array.isArray(request.entities)) {

  let ids = [];

  for (const entity of request.entities) {
    if (
      entity.type === "custom_emoji" &&
      entity.custom_emoji_id
    ) {
      ids.push(entity.custom_emoji_id);
    }
  }

  if (ids.length > 0) {
    text = "🆔 <b>Premium Emoji IDs</b>:\n\n";

    ids.forEach(id => {
      text += `<tg-emoji emoji-id="${id}"></tg-emoji>  <code>${id}</code>\n`;
    });

    text += "\n📌 <b>Usage</b>:\n";
    text += "<b>HTML:</b>\n";
    text += `<code>&lt;tg-emoji emoji-id="EMOJI_ID"&gt;&lt;/tg-emoji&gt;</code>\n\n`;

    text += "<b>MarkdownV2:</b>\n";
    text += `<code>![emoji](tg://emoji?id=EMOJI_ID)</code>`;
  }
}

Api.sendMessage({
  text: text,
  parse_mode: "HTML"
});
🧑‍💻 Coded by @devendra ©️ Copyright @BjsCodes

Repost from xCode
Our TBL Helper AI has crossed 300+ conversations 🎉 on ChatGPT store Try it and build your bots on telebothost.com - https://
Our TBL Helper AI has crossed 300+ conversations 🎉  on ChatGPT store Try it and build your bots on telebothost.com - https://chatgpt.com/g/g-690a0a4ffde4819193a77612b76d05e5-tbl-helper-ai
It is an AI assistant designed specially for: • Telegram Bot Development  • TeleBot Lang (TBL)  • Automation & Bot Logic 
More updates, features & tools coming soon. #Telegram #TelegramBots #ChatGPT #Programming #Developers

Repost from Coding with Mohit
🚀 Host Your Telegram Bot 24×7 for FREE (No VPS Needed!) Still paying for VPS or struggling to keep your Telegram bot online?
🚀 Host Your Telegram Bot 24×7 for FREE (No VPS Needed!) Still paying for VPS or struggling to keep your Telegram bot online? Stop wasting money. In this video, I show step-by-step how to host a Telegram bot completely FREE with 24×7 uptime.
✅ Free hosting platform ✅ Bot runs 24×7 ✅ No VPS, no server tension ✅ Beginner-friendly
🎥 Watch now: https://www.youtube.com/results?search_query=Host+Telegram+Bot+24%2F7+for+FREE+%7C+No+VPS (Check thumbnail) If you’re serious about Telegram bot development, this one is non-negotiable. — Join the community for more real, practical Telegram bot tutorials 👇 🔗 https://t.me/codingwithmohit05/4

Link shortner TBL codes Command: /short Use: /short <long_link> TBL code:
/* Command: /short */

if (!params) {
  Api.sendMessage({
    chat_id: chat.id,
    text:
      "❌ <b>Missing URL</b>\n\n" +
      "👉 <b>Usage:</b>\n" +
      "<code>/short https://example.com</code>\n\n" +
      "Please send a valid long link.",
    parse_mode: "HTML"
  })
  return
}

let longUrl = params.trim()

if (!longUrl.startsWith("http://") && !longUrl.startsWith("https://")) {
  Api.sendMessage({
    chat_id: chat.id,
    text:
      "❌ <b>Invalid URL</b>\n\n" +
      "URL must start with:\n" +
      "<code>http://</code> or <code>https://</code>",
    parse_mode: "HTML"
  })
  return
}

Api.sendChatAction({
  chat_id: chat.id,
  action: "typing"
})

let res = await HTTP.get({
  url: "https://tinyurl.com/api-create.php",
  query: { url: longUrl }
})

if (!res || !res.content) {
  Api.sendMessage({
    chat_id: chat.id,
    text:
      "⚠️ <b>Failed to shorten the link</b>\n" +
      "Please try again later.",
    parse_mode: "HTML"
  })
  return
}

Api.sendMessage({
  chat_id: chat.id,
  text:
    "✨ <b>URL Shortened Successfully!</b>\n\n" +
    "🔗 <b>Short Link:</b>\n" +
    "<code>" + res.content + "</code>\n\n" +
    "🚀 Powered by <b>TinyURL</b>",
  parse_mode: "HTML"
})
Powered by Tinyurl 🚀 Getting Started is Simple!  1️⃣ Sign up / Log in at https://telebothost.com/  2️⃣ Add your first bot – don’t forget to read the guide 3️⃣ Paste the codes and begin your adventure Share your bot and codes with us to be part of our journey 🤝 Don’t forget to share this with your friends

⭐ TBL Tip: Use Any Telegram API Method Dynamically! If a method isn’t available in TBL’s Api.xxx, you can still call it: Api.call("methodName", { /* params */ }) Example:
Api.call("getChat", {
  chat_id: -1007657565746
})
Use any new Telegram method instantly 🚀 Docs: https://telebothost.com/docs/#api-dynamic

Example of using emoji effect Command - /start
Api.sendMessage({
    chat_id: user.telegramid,
    text: "🎉 Celebration effect message",
    parse_mode: "Markdown",
    message_effect_id: "5046509860389126442"
});
'🔥': "5104841245755180586", '👍': "5107584321108051014", '🎉': "5046509860389126442", '👎': "5104858069142078462", '❤️': "5044134455711629726",