{"_rev":"4-743d3ad0e07633c2e888bce82d7d00ee","time":{"created":"2026-07-03T17:03:35.109Z","modified":"2026-07-03T17:03:35.730Z","1.0.0":"2026-07-02T16:45:16.575Z","1.0.1":"2026-07-03T17:03:35.529Z"},"_id":"@abdosaiko20/tg-sdk","name":"@abdosaiko20/tg-sdk","dist-tags":{"latest":"1.0.1"},"versions":{"1.0.1":{"name":"@abdosaiko20/tg-sdk","version":"1.0.1","description":"Lightweight, production-ready, comprehensive Telegram SDK for Bots and Mini Apps","main":"./dist/index.js","module":"./dist/index.mjs","types":"./dist/index.d.ts","exports":{".":{"import":"./dist/index.mjs","require":"./dist/index.js","types":"./dist/index.d.ts"},"./react":{"import":"./dist/react.mjs","require":"./dist/react.js","types":"./dist/react.d.ts"},"./types":{"import":"./dist/types.mjs","require":"./dist/types.js","types":"./dist/types.d.ts"}},"scripts":{"build":"tsup src/index.ts src/react.ts --format cjs,esm --dts --clean --external react --external http --external https","dev":"tsup src/index.ts src/react.ts --format cjs,esm --dts --watch --external react --external http --external https","prepublishOnly":"npm run build","test":"vitest","lint":"eslint src --ext .ts","format":"prettier --write 'src/**/*.ts'"},"keywords":["telegram","bot","bot-api","mini-app","webapp","sdk","lightweight","typescript","telegram-bot","telegram-mini-app","telegram-webapp","polling","webhook","keyboard","inline-keyboard","markdown","payment","stars"],"author":{"name":"tg-sdk team"},"license":"MIT","repository":{"type":"git","url":"hhttps://github.com/saikomohamed144/tg-sdk"},"homepage":"https://github.com/saikomohamed144/tg-sdk#readme","bugs":{"url":"https://github.com/saikomohamed144/tg-sdk/issues"},"engines":{"node":">=18.0.0"},"peerDependencies":{"react":">=16.8.0"},"peerDependenciesMeta":{"react":{"optional":true}},"devDependencies":{"@types/node":"^20.0.0","@types/react":"^18.0.0","react":"^18.0.0","tsup":"^8.0.0","typescript":"^5.3.0","vitest":"^1.0.0"},"sideEffects":false,"_id":"@abdosaiko20/tg-sdk@1.0.1","gitHead":"4a3c13d503c718d72d2c877ea9517bfccfe7ea42","_nodeVersion":"20.20.2","_npmVersion":"10.8.2","dist":{"integrity":"sha512-hnBfOzhllQ21QAUS6GEDQqgyGVAEMUMapuImSTbg3FpuOhfBqB2nRy12pTKh3k9xJq43Eu6RcZpM0XUcWPqajw==","shasum":"ee3ddc04acce7a1befdddec99472b3bc67d4106b","tarball":"https://registry.npmjs.org/@abdosaiko20/tg-sdk/-/tg-sdk-1.0.1.tgz","fileCount":13,"unpackedSize":372300,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIQDWMK1PwpzfhUKgKq54Od+I98D2fJa6amdxf17zeDElHgIgWJjjkzBVi8haDMCOcAMhDUEXybELXkkDOxtttdBIyy4="}]},"_npmUser":{"name":"abdosaiko20","email":"mxamxa1200@gmail.com"},"directories":{},"maintainers":[{"name":"abdosaiko20","email":"mxamxa1200@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/tg-sdk_1.0.1_1783098215338_0.22769120310656943"},"_hasShrinkwrap":false}},"maintainers":[{"name":"abdosaiko20","email":"mxamxa1200@gmail.com"}],"description":"Lightweight, production-ready, comprehensive Telegram SDK for Bots and Mini Apps","homepage":"https://github.com/saikomohamed144/tg-sdk#readme","keywords":["telegram","bot","bot-api","mini-app","webapp","sdk","lightweight","typescript","telegram-bot","telegram-mini-app","telegram-webapp","polling","webhook","keyboard","inline-keyboard","markdown","payment","stars"],"repository":{"type":"git","url":"hhttps://github.com/saikomohamed144/tg-sdk"},"author":{"name":"tg-sdk team"},"bugs":{"url":"https://github.com/saikomohamed144/tg-sdk/issues"},"license":"MIT","readme":"<p align=\"center\">\n  <img src=\"https://i.postimg.cc/tRMw2ngv/Telegram-Logo-700x394.png\" alt=\"@abdosaiko20/tg-sdk\" width=\"200\"/>\n</p>\n\n<h1 align=\"center\">@abdosaiko20/tg-sdk</h1>\n\n<p align=\"center\">\n  <strong>🚀 Lightweight, Production-Ready, Comprehensive Telegram SDK</strong>\n</p>\n\n<p align=\"center\">\n  <em>Build powerful Telegram Bots & Mini Apps with elegance and speed</em>\n</p>\n\n<p align=\"center\">\n  <a href=\"https://www.npmjs.com/package/@abdosaiko20/tg-sdk\">\n    <img src=\"https://img.shields.io/npm/v/@abdosaiko20/tg-sdk.svg?style=flat-square\" alt=\"npm version\"/>\n  </a>\n  <a href=\"https://www.npmjs.com/package/@abdosaiko20/tg-sdk\">\n    <img src=\"https://img.shields.io/npm/dm/@abdosaiko20/tg-sdk.svg?style=flat-square\" alt=\"npm downloads\"/>\n  </a>\n  <a href=\"https://bundlephobia.com/package/@abdosaiko20/tg-sdk\">\n    <img src=\"https://img.shields.io/bundlephobia/minzip/@abdosaiko20/tg-sdk?style=flat-square\" alt=\"bundle size\"/>\n  </a>\n  <a href=\"https://www.typescriptlang.org/\">\n    <img src=\"https://img.shields.io/badge/TypeScript-5.3+-3178C6?style=flat-square&logo=typescript&logoColor=white\" alt=\"TypeScript\"/>\n  </a>\n  <a href=\"https://nodejs.org/\">\n    <img src=\"https://img.shields.io/badge/Node.js-18%2B-339933?style=flat-square&logo=node.js&logoColor=white\" alt=\"Node.js\"/>\n  </a>\n  <a href=\"https://opensource.org/licenses/MIT\">\n    <img src=\"https://img.shields.io/badge/License-MIT-yellow.svg?style=flat-square\" alt=\"License: MIT\"/>\n  </a>\n  <a href=\"https://github.com/abdosaiko20/tg-sdk/stargazers\">\n    <img src=\"https://img.shields.io/github/stars/abdosaiko20/tg-sdk?style=flat-square\" alt=\"Stars\"/>\n  </a>\n</p>\n\n<p align=\"center\">\n  <a href=\"https://t.me/abdosaiko20\">\n    <img src=\"https://img.shields.io/badge/Telegram-@abdosaiko20-26A5E4?style=for-the-badge&logo=telegram&logoColor=white\" alt=\"Telegram\"/>\n  </a>\n  <a href=\"https://ton.org/\">\n    <img src=\"https://img.shields.io/badge/TON_Wallet-UQBhv7U7Jt_HH6S219IrqM4ARl6S-d_3xxgf5tbw5DgGsxch-0098EA?style=for-the-badge&logo=ton&logoColor=white\" alt=\"TON Wallet\"/>\n  </a>\n</p>\n\n---\n\n## 🌟 Why @abdosaiko20/tg-sdk?\n\n<table>\n  <tr>\n    <td width=\"50%\">\n      <h3>🎯 Complete & Comprehensive</h3>\n      <p>Every single Telegram Bot API method, every Mini App feature, every keyboard type - all in one lightweight package with <strong>zero runtime dependencies</strong>.</p>\n    </td>\n    <td width=\"50%\">\n      <h3>⚡ Blazing Fast</h3>\n      <p>Built on modern ES2022, tree-shakeable, with automatic retries, rate limiting, and connection pooling out of the box.</p>\n    </td>\n  </tr>\n  <tr>\n    <td>\n      <h3>💪 Fully Typed</h3>\n      <p>Complete TypeScript definitions for every function, parameter, and response. Enjoy autocomplete and type safety everywhere.</p>\n    </td>\n    <td>\n      <h3>🌍 Universal</h3>\n      <p>Runs everywhere: Node.js, Deno, Bun, Cloudflare Workers, Vercel Edge, React, Next.js, Vue, Svelte, Angular, and more.</p>\n    </td>\n  </tr>\n</table>\n\n---\n\n## 📦 Installation\n\n```bash\n# npm\nnpm install @abdosaiko20/tg-sdk\n\n# yarn\nyarn add @abdosaiko20/tg-sdk\n\n# pnpm\npnpm add @abdosaiko20/tg-sdk\n\n# bun\nbun add @abdosaiko20/tg-sdk\n```\n\n---\n\n## 🏗️ Architecture\n\n```\n@abdosaiko20/tg-sdk/\n├── 🤖 Bot API          →  Full Telegram Bot API with 100+ methods\n├── 📱 Mini Apps        →  Complete WebApp API for Telegram Mini Apps\n├── 🎨 Keyboards        →  Fluent builders for Inline & Reply keyboards\n├── 📝 Formatters       →  MarkdownV2 & HTML safe builders\n├── 🔄 Middleware        →  Express-like middleware engine\n├── 🛣️ Router           →  Command, hears, action, event routing\n├── 💾 Sessions          →  Built-in session with custom storage adapters\n├── 🔌 Plugins          →  Extensible plugin architecture\n├── ⭐ Payments          →  Telegram Stars & invoice management\n├── 📡 Broadcast        →  Message broadcasting with concurrency control\n└── ⚛️ React             →  First-class React hooks\n```\n\n---\n\n## 🚀 Quick Start\n\n### 🤖 Telegram Bot (Polling)\n\n```typescript\nimport { BotClient, inlineKeyboard, markdown } from '@abdosaiko20/tg-sdk';\n\n// Initialize bot\nconst bot = new BotClient({ \n  token: 'YOUR_BOT_TOKEN'\n});\n\n// Handle /start command\nbot.on('message', async (msg) => {\n  if (msg.text === '/start') {\n    // Create beautiful inline keyboard\n    const keyboard = inlineKeyboard()\n      .text('🚀 Get Started', 'start')\n      .url('🌐 Website', 'https://example.com')\n      .row()\n      .text('ℹ️ Help', 'help')\n      .text('⭐ Premium', 'premium')\n      .build();\n    \n    // Build formatted message\n    const welcomeMsg = markdown()\n      .bold('Welcome to My Bot!')\n      .newLine()\n      .text('Choose an option below:')\n      .toString();\n\n    await bot.sendMessage(msg.chat.id, welcomeMsg, {\n      parse_mode: 'MarkdownV2',\n      reply_markup: keyboard\n    });\n  }\n});\n\n// Start polling for updates\nbot.startPolling();\nconsole.log('🤖 Bot is running...');\n```\n\n### 🌐 Telegram Bot (Webhook)\n\n```typescript\nimport { BotClient, Router, Context } from '@abdosaiko20/tg-sdk';\n\nconst bot = new BotClient({ token: process.env.BOT_TOKEN! });\nconst router = new Router();\n\n// Define routes\nrouter.command('start', async (ctx) => {\n  const c = ctx as Context;\n  await c.replyWithMarkdown(\n    markdown()\n      .bold('Welcome!')\n      .newLine()\n      .text('I am a webhook-powered bot.')\n      .toString()\n  );\n});\n\nrouter.hears(/hello|hi|hey/i, async (ctx) => {\n  const c = ctx as Context;\n  await c.reply(`Hello, ${c.user?.first_name || 'there'}! 👋`);\n});\n\nrouter.action('premium', async (ctx) => {\n  const c = ctx as Context;\n  await c.answer('Opening premium features...');\n  await c.edit('🌟 Premium features unlocked!');\n});\n\n// Connect router to bot\nbot.on('message', async (update) => {\n  const ctx = new Context({ update_id: 0, message: update } as any, bot);\n  await router.middleware()(ctx, async () => {\n    await bot.sendMessage(ctx.chatId!, 'Command not recognized. Try /start');\n  });\n});\n\n// Setup webhook\nawait bot.setWebhook('https://your-domain.com/api/telegram', {\n  secret_token: 'your-secret-token'\n});\n\n// Start webhook server\nawait bot.startWebhook({ \n  port: 3000, \n  path: '/api/telegram',\n  secretToken: 'your-secret-token'\n});\n\nconsole.log('🌐 Webhook server running on port 3000');\n```\n\n### 📱 Telegram Mini App\n\n```typescript\nimport tg from '@abdosaiko20/tg-sdk';\n\n// Initialize Mini App\ntg.ready();\ntg.expand();\n\n// Get user information\nconst user = tg.user();\nconsole.log(`👤 User: ${user?.first_name} ${user?.last_name}`);\n\n// Theme support\nconst isDark = tg.isDark();\ndocument.body.className = isDark ? 'dark-theme' : 'light-theme';\n\n// Main Button with progress\ntg.MainButton.setText('💾 Save Settings');\ntg.MainButton.setColor('#4CAF50');\ntg.MainButton.setTextColor('#FFFFFF');\ntg.MainButton.show();\n\ntg.MainButton.onClick(async () => {\n  tg.MainButton.showProgress();\n  \n  try {\n    // Save to cloud storage\n    await tg.CloudStorage.set('settings', JSON.stringify({\n      theme: isDark ? 'dark' : 'light',\n      notifications: true\n    }));\n    \n    tg.HapticFeedback.notificationOccurred('success');\n    await tg.showAlert('✅ Settings saved successfully!');\n  } catch (error) {\n    tg.HapticFeedback.notificationOccurred('error');\n    await tg.showAlert('❌ Failed to save settings');\n  } finally {\n    tg.MainButton.hideProgress();\n  }\n});\n\n// Back button\ntg.BackButton.show();\ntg.BackButton.onClick(() => {\n  tg.close();\n});\n```\n\n### ⚛️ React Integration\n\n```tsx\nimport { useState } from 'react';\nimport {\n  useTelegram,\n  useTelegramUser,\n  useTelegramTheme,\n  useTelegramMainButton,\n  useTelegramPopup,\n  useTelegramHapticFeedback,\n} from '@abdosaiko20/tg-sdk';\n\nexport default function MiniApp() {\n  const { isMiniApp, platform } = useTelegram();\n  const user = useTelegramUser();\n  const { isDark, params } = useTelegramTheme();\n  const mainButton = useTelegramMainButton();\n  const popup = useTelegramPopup();\n  const haptic = useTelegramHapticFeedback();\n  const [count, setCount] = useState(0);\n\n  // Configure main button\n  useEffect(() => {\n    if (isMiniApp) {\n      mainButton.setText(`🎯 Clicks: ${count}`);\n      mainButton.setColor(isDark ? '#8774E1' : '#6C5CE7');\n      mainButton.show();\n      \n      mainButton.onClick(async () => {\n        haptic.impactOccurred('light');\n        setCount(prev => prev + 1);\n        \n        if (count >= 10) {\n          const confirmed = await popup.confirm('🏆 Reset counter?');\n          if (confirmed) setCount(0);\n        }\n      });\n    }\n  }, [isMiniApp, count, isDark]);\n\n  if (!isMiniApp) {\n    return <div>Please open in Telegram</div>;\n  }\n\n  return (\n    <div style={{\n      backgroundColor: isDark ? params.bg_color : '#FFFFFF',\n      color: isDark ? params.text_color : '#000000',\n      minHeight: '100vh',\n      padding: '24px',\n      fontFamily: '-apple-system, BlinkMacSystemFont, sans-serif'\n    }}>\n      <header style={{ textAlign: 'center', marginBottom: '40px' }}>\n        <h1 style={{ fontSize: '2rem', margin: '0 0 8px' }}>\n          👋 Hello, {user?.first_name || 'User'}!\n        </h1>\n        <p style={{ opacity: 0.7 }}>\n          Platform: {platform} • Theme: {isDark ? '🌙 Dark' : '☀️ Light'}\n        </p>\n      </header>\n\n      <main style={{ textAlign: 'center' }}>\n        <div style={{\n          background: isDark ? 'rgba(255,255,255,0.1)' : 'rgba(0,0,0,0.05)',\n          borderRadius: '20px',\n          padding: '40px',\n          marginBottom: '20px'\n        }}>\n          <h2 style={{ fontSize: '4rem', margin: '0' }}>{count}</h2>\n          <p style={{ opacity: 0.6 }}>Button Clicks</p>\n        </div>\n      </main>\n    </div>\n  );\n}\n```\n\n---\n\n## 💰 Telegram Stars (Payments)\n\n```typescript\nimport { BotClient } from '@abdosaiko20/tg-sdk';\n\nconst bot = new BotClient({ token: 'YOUR_BOT_TOKEN' });\n\n// Handle invoice creation\nbot.on('message', async (msg) => {\n  if (msg.text === '/premium') {\n    await bot.sendStarsInvoice(msg.chat.id, {\n      title: '⭐ Premium Access',\n      description: 'Unlock all premium features for 1 month',\n      payload: 'premium_monthly',\n      prices: [{ label: 'Premium', amount: 100 }],\n      max_tip_amount: 200,\n      suggested_tip_amounts: [100, 150, 200],\n      photo_url: 'https://example.com/premium-banner.jpg',\n      need_name: true,\n      need_email: true,\n    });\n  }\n});\n\n// Handle pre-checkout\nbot.on('pre_checkout_query', async (query) => {\n  await bot.answerPreCheckoutQuery(query.id, true);\n});\n\n// Handle successful payment\nbot.on('message', async (msg) => {\n  if (msg.successful_payment) {\n    await bot.sendMessage(\n      msg.chat.id,\n      '🎉 Thank you for your purchase! Premium features activated.'\n    );\n    \n    // Refund example (if needed)\n    // await bot.refundStarPayment(\n    //   msg.from!.id,\n    //   msg.successful_payment.telegram_payment_charge_id\n    // );\n  }\n});\n```\n\n---\n\n## 📡 Broadcast System\n\n```typescript\nconst results = await bot.broadcast(\n  'sendMessage',\n  { \n    text: '🔔 Important Announcement!',\n    parse_mode: 'HTML'\n  },\n  {\n    chatIds: [123456789, 987654321, 555555555],\n    concurrency: 10,\n    delay: 500,\n    stopOnError: false,\n    onStart: (total) => {\n      console.log(`📡 Broadcasting to ${total} users...`);\n    },\n    onProgress: (current, total) => {\n      const percent = ((current / total) * 100).toFixed(1);\n      console.log(`Progress: ${current}/${total} (${percent}%)`);\n    },\n    onSuccess: (chatId, result) => {\n      console.log(`✅ Sent to ${chatId}`);\n    },\n    onError: (chatId, error) => {\n      console.error(`❌ Failed for ${chatId}:`, error.message);\n    },\n    onFinish: (results) => {\n      const success = results.filter(r => r.success).length;\n      const failed = results.length - success;\n      console.log(`\n📊 Broadcast Complete:\n  ✅ Success: ${success}\n  ❌ Failed: ${failed}\n  📈 Success Rate: ${((success / results.length) * 100).toFixed(1)}%\n      `);\n    }\n  }\n);\n```\n\n---\n\n## 🔧 Advanced Examples\n\n### Session Management with Redis\n\n```typescript\nimport { BotClient, SessionManager, Context } from '@abdosaiko20/tg-sdk';\nimport Redis from 'ioredis';\n\nconst redis = new Redis();\nconst bot = new BotClient({ token: 'TOKEN' });\n\n// Redis session storage\nconst session = new SessionManager({\n  get: async (key) => {\n    const data = await redis.get(`session:${key}`);\n    return data ? JSON.parse(data) : null;\n  },\n  set: async (key, data) => {\n    await redis.set(`session:${key}`, JSON.stringify(data), 'EX', 3600);\n  },\n  delete: async (key) => {\n    await redis.del(`session:${key}`);\n  }\n});\n\n// Apply session middleware\nbot.use(session.middleware());\n\n// Use sessions in handlers\nbot.on('message', async (update) => {\n  const ctx = new Context({ update_id: 0, message: update } as any, bot);\n  \n  // Initialize session\n  ctx.session = ctx.session || {};\n  ctx.session.visits = (ctx.session.visits || 0) + 1;\n  ctx.session.lastVisit = Date.now();\n  \n  await ctx.reply(\n    `📊 Visit #${ctx.session.visits}\\n` +\n    `🕐 Last visit: ${new Date(ctx.session.lastVisit).toLocaleString()}`\n  );\n});\n\nbot.startPolling();\n```\n\n### Custom Plugin System\n\n```typescript\nimport { PluginSystem, MiddlewareContext } from '@abdosaiko20/tg-sdk';\n\nconst plugins = new PluginSystem();\n\n// Analytics plugin\nplugins.use(async (ctx: MiddlewareContext, next) => {\n  const startTime = Date.now();\n  const user = (ctx as any).user;\n  \n  console.log(`📊 [Analytics] User ${user?.id} started`);\n  \n  await next();\n  \n  const duration = Date.now() - startTime;\n  console.log(`📊 [Analytics] Completed in ${duration}ms`);\n  \n  // Send to your analytics service\n  await fetch('https://analytics.example.com/track', {\n    method: 'POST',\n    body: JSON.stringify({\n      userId: user?.id,\n      duration,\n      timestamp: Date.now()\n    })\n  });\n});\n\n// Rate limiter plugin\nplugins.use(async (ctx: MiddlewareContext, next) => {\n  const user = (ctx as any).user;\n  const userId = user?.id?.toString() || 'anonymous';\n  \n  // Simple in-memory rate limiting\n  const key = `rate_limit:${userId}`;\n  const requests = (globalThis as any).__rateLimitCache?.get(key) || 0;\n  \n  if (requests > 30) {\n    throw new Error('Rate limit exceeded');\n  }\n  \n  if (!(globalThis as any).__rateLimitCache) {\n    (globalThis as any).__rateLimitCache = new Map();\n  }\n  \n  (globalThis as any).__rateLimitCache.set(key, requests + 1);\n  setTimeout(() => {\n    (globalThis as any).__rateLimitCache.delete(key);\n  }, 60000);\n  \n  await next();\n});\n\n// Apply plugins\nbot.use(plugins.middleware());\n```\n\n### Next.js Route Handler (Full Example)\n\n```typescript\n// app/api/telegram/route.ts\nimport { BotClient, Router, Context } from '@abdosaiko20/tg-sdk';\nimport { NextResponse } from 'next/server';\n\nconst bot = new BotClient({ token: process.env.TELEGRAM_BOT_TOKEN! });\nconst router = new Router();\n\n// Setup routes\nrouter.command('start', async (ctx) => {\n  const c = ctx as Context;\n  await c.reply('Welcome to Next.js Telegram Bot! 🚀');\n});\n\nrouter.hears('status', async (ctx) => {\n  const c = ctx as Context;\n  const me = await bot.getMe();\n  await c.reply(`Bot Status:\\n• Name: ${me.first_name}\\n• Username: @${me.username}`);\n});\n\n// Webhook handler\nexport async function POST(request: Request) {\n  try {\n    const update = await request.json();\n    \n    // Create context and process\n    const ctx = new Context(update, bot);\n    await router.middleware()(ctx, async () => {\n      // Default handler\n      if (update.message?.chat?.id) {\n        await bot.sendMessage(update.message.chat.id, 'Command not recognized');\n      }\n    });\n    \n    return NextResponse.json({ ok: true });\n  } catch (error) {\n    console.error('Webhook error:', error);\n    return NextResponse.json({ ok: false }, { status: 500 });\n  }\n}\n\n// Webhook setup\nexport async function GET() {\n  const webhookUrl = `${process.env.VERCEL_URL}/api/telegram`;\n  \n  await bot.setWebhook(webhookUrl, {\n    secret_token: process.env.WEBHOOK_SECRET\n  });\n  \n  return NextResponse.json({ \n    ok: true, \n    webhook: webhookUrl \n  });\n}\n```\n\n---\n\n## 📚 Complete API Reference\n\n### BotClient Methods\n\n<details>\n<summary><strong>📨 Message Methods</strong></summary>\n\n| Method | Description | Options |\n|--------|-------------|---------|\n| `sendMessage(chatId, text, options?)` | Send text message | `parse_mode`, `reply_markup`, `disable_notification`, etc. |\n| `sendPhoto(chatId, photo, options?)` | Send photo | `caption`, `has_spoiler`, `reply_markup` |\n| `sendVideo(chatId, video, options?)` | Send video | `duration`, `width`, `height`, `supports_streaming` |\n| `sendAudio(chatId, audio, options?)` | Send audio | `performer`, `title`, `thumbnail` |\n| `sendDocument(chatId, document, options?)` | Send document | `thumbnail`, `disable_content_type_detection` |\n| `sendAnimation(chatId, animation, options?)` | Send animation/GIF | `duration`, `has_spoiler` |\n| `sendVoice(chatId, voice, options?)` | Send voice note | `duration` |\n| `sendVideoNote(chatId, videoNote, options?)` | Send video note | `duration`, `length` |\n| `sendMediaGroup(chatId, media, options?)` | Send media group | Array of `InputMedia` |\n| `sendLocation(chatId, lat, lon, options?)` | Send location | `live_period`, `heading` |\n| `sendVenue(chatId, lat, lon, title, addr)` | Send venue | `foursquare_id`, `google_place_id` |\n| `sendContact(chatId, phone, name, options?)` | Send contact | `vcard` |\n| `sendPoll(chatId, question, options)` | Send poll | `type`, `allows_multiple_answers` |\n| `sendDice(chatId, options?)` | Send dice/emoji | `emoji` (🎲, 🎯, 🏀, ⚽, 🎳, 🎰) |\n| `sendSticker(chatId, sticker, options?)` | Send sticker | `emoji` |\n| `sendChatAction(chatId, action)` | Send typing/broadcast action | `typing`, `upload_photo`, etc. |\n\n</details>\n\n<details>\n<summary><strong>✏️ Edit & Delete Methods</strong></summary>\n\n| Method | Description |\n|--------|-------------|\n| `editMessageText(chatId, msgId, text, options?)` | Edit message text |\n| `editMessageCaption(chatId, msgId, options?)` | Edit media caption |\n| `editMessageMedia(chatId, msgId, media)` | Edit message media |\n| `editMessageReplyMarkup(chatId, msgId, markup)` | Edit inline keyboard |\n| `deleteMessage(chatId, msgId)` | Delete message |\n| `deleteMessages(chatId, msgIds[])` | Delete multiple messages |\n| `stopPoll(chatId, msgId)` | Stop a running poll |\n\n</details>\n\n<details>\n<summary><strong>👥 Chat Management</strong></summary>\n\n| Method | Description |\n|--------|-------------|\n| `getChat(chatId)` | Get chat information |\n| `getChatAdministrators(chatId)` | Get chat admins |\n| `getChatMemberCount(chatId)` | Get member count |\n| `getChatMember(chatId, userId)` | Get specific member |\n| `banChatMember(chatId, userId)` | Ban member |\n| `unbanChatMember(chatId, userId)` | Unban member |\n| `restrictChatMember(chatId, userId, perms)` | Restrict member |\n| `promoteChatMember(chatId, userId, opts)` | Promote to admin |\n| `setChatPermissions(chatId, permissions)` | Set default permissions |\n| `setChatTitle(chatId, title)` | Change chat title |\n| `setChatDescription(chatId, desc)` | Change description |\n| `setChatPhoto(chatId, photo)` | Change chat photo |\n| `deleteChatPhoto(chatId)` | Remove chat photo |\n| `pinChatMessage(chatId, msgId)` | Pin message |\n| `unpinChatMessage(chatId, msgId?)` | Unpin message |\n| `leaveChat(chatId)` | Bot leaves chat |\n\n</details>\n\n<details>\n<summary><strong>💰 Payments & Stars</strong></summary>\n\n| Method | Description |\n|--------|-------------|\n| `sendInvoice(chatId, ...)` | Send payment invoice |\n| `createInvoiceLink(...)` | Create invoice link |\n| `answerShippingQuery(id, ok, opts)` | Answer shipping query |\n| `answerPreCheckoutQuery(id, ok, opts)` | Answer pre-checkout |\n| `createStarsInvoice(params)` | Create Stars invoice link |\n| `sendStarsInvoice(chatId, params)` | Send Stars invoice |\n| `refundStarPayment(userId, chargeId)` | Refund Stars payment |\n\n</details>\n\n<details>\n<summary><strong>🔧 Webhook & Polling</strong></summary>\n\n| Method | Description |\n|--------|-------------|\n| `startPolling(options?)` | Start long polling |\n| `stopPolling()` | Stop polling |\n| `setWebhook(url, options?)` | Set webhook URL |\n| `deleteWebhook(options?)` | Remove webhook |\n| `getWebhookInfo()` | Get webhook status |\n| `startWebhook(options?)` | Start webhook server |\n| `stopWebhook()` | Stop webhook server |\n\n</details>\n\n---\n\n## 🎨 Keyboard Builders\n\n### Inline Keyboard\n\n```typescript\nimport { inlineKeyboard } from '@abdosaiko20/tg-sdk';\n\nconst keyboard = inlineKeyboard()\n  .text('🚀 Action', 'action_1')\n  .url('🌐 Visit Site', 'https://example.com')\n  .row()\n  .webApp('📱 Open App', 'https://app.example.com')\n  .login('🔑 Login', { url: 'https://auth.example.com' })\n  .row()\n  .switchInline('📤 Share', 'check this out')\n  .switchInlineCurrentChat('💬 Share Here', 'look')\n  .row()\n  .pay('⭐ Pay 100 Stars')\n  .build();\n```\n\n### Reply Keyboard\n\n```typescript\nimport { replyKeyboard, removeKeyboard, forceReply } from '@abdosaiko20/tg-sdk';\n\nconst keyboard = replyKeyboard()\n  .text('📊 Stats')\n  .text('⚙️ Settings')\n  .row()\n  .requestContact('📞 Share Contact')\n  .requestLocation('📍 Share Location')\n  .row()\n  .requestPoll('📋 Create Poll')\n  .webApp('🚀 Launch App', 'https://app.example.com')\n  .resize()\n  .oneTime()\n  .placeholder('Choose an option...')\n  .build();\n\n// Remove keyboard\nconst remove = removeKeyboard();\n\n// Force reply\nconst force = forceReply('Enter your name...');\n```\n\n---\n\n## 📝 Formatters\n\n### MarkdownV2\n\n```typescript\nimport { markdown, ParseMode } from '@abdosaiko20/tg-sdk';\n\nconst message = markdown()\n  .bold('Important Announcement')\n  .newLine()\n  .newLine()\n  .text('We are excited to share ')\n  .italic('amazing news')\n  .text(' with you!')\n  .newLine()\n  .newLine()\n  .spoiler('Spoiler: Something big is coming!')\n  .newLine()\n  .newLine()\n  .link('👉 Learn More', 'https://example.com')\n  .toString();\n\nawait bot.sendMessage(chatId, message, {\n  parse_mode: ParseMode.MarkdownV2\n});\n```\n\n### HTML\n\n```typescript\nimport { html } from '@abdosaiko20/tg-sdk';\n\nconst message = html()\n  .bold('Welcome!')\n  .newLine()\n  .text('This is ')\n  .italic('italic')\n  .text(' and this is ')\n  .underline('underlined')\n  .text('.')\n  .newLine()\n  .newLine()\n  .pre('const greeting = \"Hello World\";\\nconsole.log(greeting);', 'javascript')\n  .newLine()\n  .link('🔗 Documentation', 'https://docs.example.com')\n  .toString();\n\nawait bot.sendMessage(chatId, message, {\n  parse_mode: 'HTML'\n});\n```\n\n---\n\n## ⚛️ React Hooks Reference\n\n| Hook | Description | Returns |\n|------|-------------|---------|\n| `useTelegram()` | Core Telegram info | `{ isTelegram, isMiniApp, platform, version }` |\n| `useTelegramUser()` | Current user data | `TelegramUser \\| null` |\n| `useTelegramTheme()` | Theme information | `{ params, isDark }` |\n| `useTelegramMainButton()` | Main button controls | `{ show, hide, setText, onClick, ... }` |\n| `useTelegramBackButton()` | Back button controls | `{ show, hide, onClick }` |\n| `useTelegramSettingsButton()` | Settings button | `{ show, hide, onClick }` |\n| `useTelegramViewport()` | Viewport info | `{ height, width, isExpanded, ... }` |\n| `useTelegramPopup()` | Popup dialogs | `{ show, alert, confirm }` |\n| `useTelegramHapticFeedback()` | Haptic feedback | `{ impactOccurred, notificationOccurred }` |\n| `useTelegramCloudStorage()` | Cloud storage | `{ get, set, remove, loading, error }` |\n| `useTelegramClipboard()` | Clipboard access | `{ copy, read }` |\n| `useTelegramEvent(event, cb)` | Event listener | `void` |\n\n---\n\n## 🌐 Platform Support\n\n| Platform | Support | Notes |\n|----------|---------|-------|\n| **Node.js** 18+ | ✅ Full | All features supported |\n| **Node.js** 20+ | ✅ Full | Recommended |\n| **Node.js** 22+ | ✅ Full | Latest LTS |\n| **Deno** | ✅ Full | Import from npm |\n| **Bun** | ✅ Full | Native support |\n| **Cloudflare Workers** | ✅ | Webhook mode only |\n| **Vercel Edge** | ✅ | Route handlers |\n| **React** 16.8+ | ✅ | All hooks |\n| **Next.js** 13+ | ✅ | App & Pages Router |\n| **Vue 3** | ✅ | Composition API |\n| **Svelte/SvelteKit** | ✅ | Full support |\n| **Angular 12+** | ✅ | Services |\n| **Nuxt 3** | ✅ | Auto-import |\n\n---\n\n## 💖 Support the Project\n\n<p align=\"center\">\n  <strong>If you find this SDK useful, please consider supporting its development:</strong>\n</p>\n\n<p align=\"center\">\n  <a href=\"https://t.me/abdosaiko20\">\n    <img src=\"https://img.shields.io/badge/📱_Telegram-@abdosaiko20-26A5E4?style=for-the-badge&logo=telegram&logoColor=white\" alt=\"Telegram\"/>\n  </a>\n  &nbsp;&nbsp;\n\n<p align=\"center\">\n  <strong>TON Wallet Address:</strong><br/>\n  <code>UQBhv7U7Jt_HH6S219IrqM4ARl6S-d_3xxgf5tbw5DgGsxch</code>\n</p>\n\n<p align=\"center\">\n  ⭐ Star this repository if you find it useful!<br/>\n  🐛 Report issues and suggest features<br/>\n  🤝 Contributions are always welcome!\n</p>\n\n---\n\n## 📄 License\n\nMIT © [@abdosaiko20](https://github.com/saikomohamed144)\n\n---\n\n## 🔗 Links\n\n- 📦 [NPM Package](https://www.npmjs.com/package/saikomohamed144/tg-sdk)\n- 💻 [GitHub Repository](https://github.com/saikomohamed144/tg-sdk)\n- 🐛 [Issue Tracker](https://github.com/saikomohamed144/tg-sdk/issues)\n- 📖 [Telegram Bot API Docs](https://core.telegram.org/bots/api)\n- 📱 [Telegram Mini Apps Docs](https://core.telegram.org/bots/webapps)\n- 💎 [TON Blockchain](https://ton.org)\n\n---\n\n<p align=\"center\">\n  <sub>Built with ❤️ by <a href=\"https://t.me/abdosaiko20\">@abdosaiko20</a></sub>\n</p>\n","readmeFilename":"README.md"}