stark91611/GAMA_EXPERT_BOTPublic · Bot Template

ProfileTelegram

AIThis Telegram bot offers multiple utility features including Instagram media downloading, random quote generation, AI-driven chat responses, and Pinterest image searching. It also features channel join verification, automated reaction handlers, and comprehensive administrative tools such as broadcasting and role management.

Utilityinstagramdownloaderaipinterestbroadcastadmin
15 commands0 envUpdated 24d agoCreated Sep 22, 2026
Back to folder

commands/_search.js

javascript · 82 lines

Raw
1/**#command2name: /search3answer: 4keyboard: 5parse_mode: markdown6aliases: 7allow_only_group: false8need_reply: false9is_web: 010#command**/11 12let query = message13 14if (!query) {15  Bot.sendMessage("Please enter a search query.")16  return17}18 19User.set("q", query, "string")20 21let res = await HTTP.post({22  url: "https://pinterest-api-bay.vercel.app/v5/pins/search",23  body: {24    query: query,25    count: 10,26    compact: true27  }28})29 30if (!res.ok) {31  Bot.sendMessage("Request failed. Please try again later.")32  return33}34 35let data36 37try {38  data = res.data39} catch (e) {40  Bot.sendMessage("Failed to parse response.")41  return42}43 44if (!data.items || data.items.length === 0) {45  Bot.sendMessage("No results found.")46  return47}48 49let savedQuery = User.get("q") || "Result"50let botName = bot.name51 52for (let i = 0; i < data.items.length; i++) {53  let item = data.items[i]54 55  let title = item.title ? item.title : savedQuery56  let image = item.image57  let link = item.url ? item.url : ""58 59  let buttons = []60 61  if (link) {62    buttons.push([{ text: "View on Pinterest", url: link }])63  }64 65  buttons.push([{ text: "Copy Image URL", copy_text: { text: image } }])66 67  let caption =68    "<b>" + title + "</b>\n" +69    "<i>Query:</i> " + savedQuery + "\n" +70    "<i>Searched by:</i> @" + botName71 72  await Api.sendPhoto({73    chat_id: user.telegramid,74    photo: image,75    caption: caption,76    parse_mode: "HTML",77    disable_web_page_preview: true,78    reply_markup: {79      inline_keyboard: buttons80    }81  })82                          }