adityajat/SaarvamAI_botPublic · Bot Template

ProfileTelegram

AISarvam AI is a multi‑purpose Telegram bot that lets users ask questions, get explanations, convert text to speech, and translate messages using the Sarvam AI API. It also offers group administration commands such as warn, mute, ban, pin, delete, and announcements, and can clear personal or group AI memory. The bot uses the TeleBotHost TBL framework with Bot, Api, db, and HTTP calls, and provides inline keyboards for language and voice selection.

Ai Assistantaivoicetranslatemoderationadminsarvam
34 commands4 envUpdated 15d agoCreated Sep 14, 2026
Back to folder

commands/_voice.js

javascript · 74 lines

Raw
1/**#command2name: /voice3answer: 4keyboard: 5parse_mode: markdown6aliases: 7allow_only_group: false8need_reply: false9is_web: 010#command**/11 12// ===============================13// /voice14// ===============================15 16let text = "";17 18// If /voice is used with text19if (params && params.trim()) {20  text = params.trim();21}22 23// Otherwise use the replied-to message24if (!text && update.message && update.message.reply_to_message) {25  let replied = update.message.reply_to_message;26 27  text = replied.text || replied.caption || "";28}29 30if (!text) {31  Api.sendMessage({32    text: "🎙️ Please use /voice with some text or reply to a message with /voice."33  });34  return;35}36 37// Save the request38await db.user.set("voice_request", {39  text: text,40  chat_id: update.message.chat.id,41  message_id: update.message.message_id42});43 44// Language menu45Api.sendMessage({46  text: "🌐 Choose the language:",47  reply_markup: {48    inline_keyboard: [49      [50        { text: "🇮🇳 Hindi", callback_data: "vl_hi-IN" },51        { text: "🇬🇧 English", callback_data: "vl_en-IN" }52      ],53      [54        { text: "🇧🇩 Bengali", callback_data: "vl_bn-IN" },55        { text: "🇮🇳 Tamil", callback_data: "vl_ta-IN" }56      ],57      [58        { text: "🇮🇳 Telugu", callback_data: "vl_te-IN" },59        { text: "🇮🇳 Gujarati", callback_data: "vl_gu-IN" }60      ],61      [62        { text: "🇮🇳 Kannada", callback_data: "vl_kn-IN" },63        { text: "🇮🇳 Malayalam", callback_data: "vl_ml-IN" }64      ],65      [66        { text: "🇮🇳 Marathi", callback_data: "vl_mr-IN" },67        { text: "🇮🇳 Punjabi", callback_data: "vl_pa-IN" }68      ],69      [70        { text: "🇮🇳 Odia", callback_data: "vl_od-IN" }71      ]72    ]73  }74});