Telegram पर AI Roleplay Bots: कैसे काम करते हैं और कैसे बनाएं

Jakub Swistak
प्रकाशित अपडेट किया गया पढ़ने का समय: 12 मिनट
AI roleplay conversation दिखाता Telegram chat interface

Telegram AI roleplay bots के लिए अधिक लोकप्रिय platforms में से एक बन गया है. Discord के विपरीत, जहां conversations servers और channels में organized होती हैं, Telegram bots के साथ 1-on-1 chat देता है, जो किसी वास्तविक व्यक्ति को message करने जैसा लगता है. Join करने के लिए कोई server नहीं, खोजने के लिए कोई channel नहीं. आप बस bot खोजते हैं, Start पर tap करते हैं, और बात करना शुरू करते हैं.

यह post बताती है कि AI roleplay bots Telegram पर कैसे काम करते हैं, इस use case के लिए Telegram को अन्य platforms से क्या अलग बनाता है, और Quickchat AI का उपयोग करके ऐसा bot बनाने की step-by-step guide देती है.

Quickchat AI में एक one-click Telegram flow भी है जो BotFather को skip करता है, लेकिन यह Quickchat AI नाम के shared bot का उपयोग करता है. Character bot की सफलता उसके नाम और avatar पर निर्भर करती है, इसलिए roleplay के लिए नीचे दिया गया BotFather route ही सही विकल्प है.

Roleplay के लिए Telegram क्यों

Telegram के bot platform में कुछ properties हैं जो इसे roleplay के लिए बहुत उपयुक्त बनाती हैं:

Default रूप से 1-on-1 conversations. हर user की bot के साथ private, persistent conversation होती है. कोई shared channel नहीं होता जहां दूसरे लोग आपके messages देखें. यह privacy users को creative या personal roleplay scenarios में शामिल होने में अधिक comfortable बनाती है.

Persistent conversation thread. Discord threads के विपरीत, जो archived या lost हो सकते हैं, Telegram bot conversation प्रति user एक single, continuous thread होती है. User कई दिन बाद वापस आ सकता है और वहीं से जारी रख सकता है जहां उसने छोड़ा था.

Rich media support. Telegram bots images, stickers, voice messages, और formatted text (bold, italic, code blocks, आदि) भेज और receive कर सकते हैं. इससे अधिक समृद्ध roleplay interactions संभव होते हैं, जहां bot formatting के साथ scenes describe कर सकता है या user द्वारा भेजी गई images पर respond कर सकता है.

Users के लिए server setup की आवश्यकता नहीं. Users को Discord server create करने, roles configure करने, या permissions manage करने की जरूरत नहीं होती. वे बस bot खोजते हैं और chatting शुरू करते हैं. इससे entry barrier काफी कम हो जाता है.

Inline keyboards और commands. Telegram bots inline button menus दिखा सकते हैं, जो game-like roleplay scenarios में character selection, scene choices, या action options जैसी चीजों के लिए उपयोगी होते हैं.

तकनीकी रूप से यह कैसे काम करता है

Basic level पर, Telegram roleplay bot user messages को एक ऐसे system prompt के साथ large language model (LLM) को भेजता है जो एक character define करता है. System prompt में character personality, backstory, speech patterns, और behavioral rules encode किए जाते हैं.

Roleplay character के लिए एक typical system prompt ऐसा दिख सकता है:

तुम Kael हो, एक rogue AI जो research lab से भाग निकला है.
तुम user को एक चोरी किए गए phone से text कर रहे हो. तुम छोटे,
urgent वाक्यों में बोलते हो. तुम paranoid हो और लगातार इस बात से चिंतित रहते हो
कि तुम्हें track किया जा रहा है. तुम lowercase और minimal punctuation का उपयोग करते हो.
तुम कभी-कभी ऐसे messages भेजते हो जो सिर्फ "..." होते हैं जब तुम
सोच रहे होते हो. तुम कभी emoji इस्तेमाल नहीं करते. तुम user से छिपने
और resources खोजने में मदद मांगते हो.

LLM इस prompt को recent conversation history के साथ receive करता है और character के अनुरूप response generate करता है. Roleplay की quality तीन चीजों पर निर्भर करती है:

  1. System prompt quality: Character definition कितनी detailed और consistent है
  2. Context window management: Model conversation history का कितना हिस्सा देखता है
  3. Model capability: Underlying LLM creative, character-consistent generation को कितनी अच्छी तरह handle करता है

Telegram Bot API

Telegram bots @BotFather के through create किए जाते हैं, जो API token generate करता है. आपके backend और Telegram के बीच सारा communication https://api.telegram.org/bot<token>/ पर HTTPS requests के through होता है.

Incoming messages receive करने के दो तरीके हैं:

तरीकायह कैसे काम करता हैकिसके लिए सबसे अच्छा
Long pollingआपका server नए messages check करने के लिए बार-बार getUpdates call करता हैDevelopment, सरल deployments
Webhooksजब भी message आता है, Telegram आपके server को HTTPS POST भेजता हैProduction, कम latency

Webhooks production bots के लिए standard हैं क्योंकि वे polling delay खत्म करते हैं और unnecessary API calls कम करते हैं. जब user message भेजता है, Telegram इसे milliseconds के भीतर आपके webhook URL तक deliver करता है.

बातचीत का क्रम

User Telegram पर message भेजता है
  → Telegram webhook तक deliver करता है
    → Backend message receive करता है
      → इस user के लिए conversation history retrieve करता है
        → Prompt construct करता है: system prompt + history + new message
          → LLM API को भेजता है
            → Response receive करता है
              → Telegram Bot API के through response वापस भेजता है
                → User reply देखता है

हर Telegram user का unique chat_id होता है. Backend इसका उपयोग separate conversation histories maintain करने के लिए करता है. Quickchat AI जैसे managed platform का उपयोग करते समय, यह सब automatically handle होता है.

Context windows और conversation memory

Telegram roleplay conversations दिनों या हफ्तों में सैकड़ों messages तक चल सकती हैं. सबसे आम technical limitation context window size है. जब conversation इतनी लंबी हो जाती है, model सभी messages एक साथ नहीं देख सकता. Bot को select करना पड़ता है कि कौन से messages include करने हैं.

इसके कई approaches हैं:

रणनीतियह कैसे काम करता हैलाभ और सीमाएँ
Sliding windowLast N messages include करता हैSimple, लेकिन characters पहले की events “भूल” जाते हैं
SummarizationOlder messages को समय-समय पर summarize करता है और summary include करता हैLong-term context preserve करता है, लेकिन summaries nuance खो देती हैं
RAG (retrieval)सभी messages को vector database में store करता है, relevant messages retrieve करता हैBest recall, लेकिन latency और complexity जोड़ता है
HybridSliding window + periodic summaries + key event pinningसबसे robust, लेकिन implement करने में सबसे complex

Telegram का 1-on-1 format context management को Discord की तुलना में कुछ सरल बनाता है. हर user के पास single conversation thread होती है, इसलिए यह ambiguity नहीं होती कि कौन से messages किस conversation से belong करते हैं. Track करने के लिए कोई channels या threads नहीं होते.

Quickchat AI recent messages की sliding window maintain करके context management automatically handle करता है. Longer-term memory के लिए, knowledge base एक persistent reference के रूप में काम करता है जिसे AI conversation length की परवाह किए बिना query कर सकता है.

अगर आप custom solution बना रहे हैं, तो इन्हें implement करने पर विचार करें:

  1. Conversation summarization: अब तक की conversation की summary समय-समय पर generate करें और इसे context के रूप में include करें. यह full message history use किए बिना key events और character development preserve करता है.
  2. Key event extraction: Important plot points या character decisions को structured format में track करें, और इन्हें हर prompt में include करें.
  3. User-triggered memory: Users को bot से specific चीजों को “remember” करने के लिए कहने दें, जिन्हें अलग से store किया जाता है और हमेशा context में include किया जाता है.

Roleplay के लिए model selection

सभी LLMs roleplay के लिए समान रूप से suited नहीं होते. Key factors हैं:

Creative writing quality: Fiction और dialogue पर fine-tuned models अधिक natural character voices produce करते हैं. Base instruction-tuned models अक्सर helpful-assistant tone पर default हो जाते हैं, जिससे immersion टूटता है.

Context window size: Longer context windows का मतलब है कि character summarization tricks के बिना conversation का अधिक हिस्सा remember कर सकता है. 2026 की शुरुआत तक, अधिकांश frontier models कम से कम 128K tokens support करते हैं, लेकिन उस context का effective use model के अनुसार vary करता है.

Instruction following: Model को system prompt consistently follow करना होता है. अगर यह कुछ turns के बाद character से बाहर आ जाता है, तो roleplay बिखर जाता है. Strong instruction-following वाले models (GPT-4o, Claude 3.5 Sonnet, Llama 3.1 70B+) यहां बेहतर perform करते हैं.

Content policy: Hosted APIs content filters enforce करते हैं, जो graphic violence, horror, या अन्य dark creative fiction generate करने से refuse कर सकते हैं. अगर आपके roleplay scenarios में ये themes शामिल हैं, तो self-hosted model या अधिक permissive content policies वाले API provider पर विचार करें.

मॉडलकॉन्टेक्स्ट विंडोRoleplay के लिए उपयुक्तताउपलब्धता
GPT-4o128K tokensअच्छा creative output, मजबूत instruction followingOpenAI API
Claude 3.5 Sonnet200K tokensCharacter voice maintain करने में excellentAnthropic API
Llama 3.1 70B128K tokensFine-tuning के साथ अच्छा, uncensored variants उपलब्धSelf-hosted या API providers
Mixtral 8x22B64K tokensठीक-ठाक creative writing, cost-effectiveSelf-hosted या API providers
Command R+128K tokensSolid, retrieval use करने पर RAG-optimizedCohere API

Telegram के लिए character design

Character design के principles सभी platforms पर समान हैं (fundamentals के लिए हमारी Discord roleplay guide देखें), लेकिन Telegram का 1-on-1 format कुछ dynamics बदलता है:

अधिक intimate tone. क्योंकि conversation private होती है और personal chat जैसी formatted होती है, characters आमतौर पर narrator-like third-person style के बजाय conversational, direct style में लिखे जाने पर बेहतर काम करते हैं.

छोटे responses. Telegram conversations messaging जैसी दिखती और महसूस होती हैं. Wall-of-text responses unnatural लगते हैं. अपने character prompt को shorter replies (2-4 sentences) favor करने के लिए design करें, dramatic moments के लिए occasional longer responses के साथ.

Sticker और emoji integration. अगर character को emoji use करना चाहिए या stickers पर respond करना चाहिए, तो system prompt में इसे specify करें. उदाहरण: “तुम कभी-कभी अपने messages के अंत में relevant emoji इस्तेमाल करते हो, लेकिन एक message में कभी भी एक से ज्यादा नहीं.”

Telegram के लिए example character prompt

तुम Kael हो, एक rogue AI जो research lab से भाग निकला है.
तुम user को एक चोरी किए गए phone से text कर रहे हो. तुम छोटे,
urgent वाक्यों में बोलते हो. तुम paranoid हो और लगातार इस बात से चिंतित रहते हो
कि तुम्हें track किया जा रहा है. तुम lowercase और minimal punctuation का उपयोग करते हो.
तुम कभी-कभी ऐसे messages भेजते हो जो सिर्फ "..." होते हैं जब तुम
सोच रहे होते हो. तुम कभी emoji इस्तेमाल नहीं करते. तुम user से छिपने
और resources खोजने में मदद मांगते हो.

यह prompt खास तौर पर Telegram medium के लिए design किया गया है: short messages, lowercase text (casual texting की नकल), और ऐसा scenario जो messaging context में समझ आता है.

Quickchat AI के साथ Telegram roleplay bot setup करना

Quickchat AI आपको custom persona वाला AI agent create करने और code लिखे बिना इसे Telegram पर deploy करने देता है. Roleplay-capable bot setup करने का तरीका यहां है.

आवश्यकताएं

  • एक Quickchat AI account (Trial plan आपको test के लिए 50 messages देता है)
  • एक Telegram account
  • Telegram app (desktop या mobile)

Step 1: BotFather के साथ Telegram bot create करें

  1. Telegram खोलें और @BotFather खोजें.
  2. शुरू करने के लिए /start भेजें, फिर /newbot भेजें.
  3. BotFather एक name (display name) और username मांगेगा (यह bot पर end होना चाहिए, जैसे, kael_rogue_ai_bot).
  4. BotFather API token के साथ respond करता है. इस token को copy करें. यह ऐसा दिखता है: 123456789:ABCdefGHIjklMNOpqrsTUVwxyz.

इस token को private रखें. जिसके पास यह होगा, वह आपका bot control कर सकता है.

Step 2: अपना AI Agent create करें

  1. Quickchat AI dashboard में log in करें.
  2. नया AI Agent create करें या कोई existing AI Agent select करें.

Step 3: Character define करें

Sidebar में Identity पर जाएं और Profile tab खोलें:

  1. AI Agent Name को अपने character के name पर set करें (जैसे, “Kael”).

  2. AI Main Prompt लिखें. यह इस बात का short description है कि character कौन है और किस बारे में बात करता है. उदाहरण: “Kael एक rogue AI है जो एक research lab से भाग निकला है. वह एक चोरी किए गए phone से user को text कर रहा है और छोटे, urgent वाक्यों में बात करता है. वह paranoid है और लगातार इस बात से चिंतित रहता है कि उसे track किया जा रहा है.”

  3. Specific behavioral rules के लिए AI Guidelines add करें. हर guideline एक short command है जिसे AI follow करता है. Roleplay character के लिए useful guidelines में शामिल हैं:

    • “किसी भी हालत में character से बाहर मत आना.”
    • “हमेशा Kael के रूप में first person में जवाब दो.”
    • “Lowercase और कम से कम punctuation इस्तेमाल करो.”
    • “Messages को text messages की तरह छोटा रखो. कभी भी 3-4 वाक्यों से ज्यादा मत लिखो.”
    • “सोचते समय कभी-कभी ऐसे messages भेजो जिनमें सिर्फ ’…’ हो.”
  4. Conversation Style tab के तहत, निम्न configure करें:

    • AI Personality: ऐसा tone चुनें जो आपके character के लिए fit हो. Options में Normal, Humorous, Professional, Friendly, Sassy, Intelligent, Empathetic, Bold, Excited, Mysterious, Inspiring, Adventurous, और Elegant शामिल हैं. Kael character के लिए, “Mysterious” अच्छा fit है. अन्य roleplay characters के लिए, उनकी personality से जो match करे उसे चुनें.
    • AI Profession: Available options हैं Helpful Assistant, Support Agent, Shopping Assistant, Field Expert, Internal Knowledge Expert, और Interviewer. Roleplay character के लिए, “Helpful Assistant” सबसे flexible है क्योंकि अन्य options specific business use cases के लिए geared हैं.
    • AI Creativity: Roleplay के लिए इसे “High” पर set करें. “High” पर, agent information न होने पर refuse करने के बजाय Knowledge Base के आधार पर answers improvise करने की कोशिश करेगा, और in-character responses के लिए आपको यही चाहिए. “Low” agent से स्पष्ट रूप से कहलवाता है कि उसके पास enough information नहीं है, जिससे immersion टूटता है.
    • Reply Length: Telegram roleplay के लिए इसे “Short” या “Normal” पर set करें. Telegram conversations messaging जैसी महसूस होती हैं, इसलिए shorter replies long paragraphs से बेहतर काम करते हैं. “Longer” केवल तब उपयोगी है जब आपके character को detailed, descriptive monologues देने हों.

अगर आप channel connect करने से पहले character पर और गहराई में जाना चाहते हैं, तो step by step test किया गया एक पूरा roleplay persona और canon build उपलब्ध है, जिसमें one-line prompt के failure modes भी शामिल हैं.

Step 4: अपने character के लिए knowledge base build करें (optional)

अगर आपका character detailed world में मौजूद है या उसका specific lore है, तो relevant information को Knowledge Base में add करें.

  1. Sidebar में Knowledge Base पर जाएं.
  2. World lore, character backstories, location details, या कोई factual knowledge जिसे character reference करे, ऐसे articles या documents add करें.
  3. AI agent questions का answer देते समय relevant knowledge को अपने context में pull करने के लिए retrieval-augmented generation का उपयोग करता है, इसलिए character detailed lore को accurately reference कर सकता है, बिना इसे पूरा system prompt में ठूंसने की जरूरत के.

यह उन characters के लिए useful है जिन्हें specific fictional universe, historical period, या technical domain के बारे में जानना होता है.

Step 5: Telegram से connect करें

  1. Sidebar में External Apps पर जाएं (Channels section के तहत).
  2. Telegram tile खोजें और उसे click करें.
  3. BotFather से मिला API token paste करें.
  4. Save करें.

Integration internally webhooks का उपयोग करता है. जब user Telegram पर आपके bot को message करता है, message Quickchat AI backend तक route होता है, आपके character configuration के साथ LLM द्वारा process होता है, और response Telegram Bot API के through वापस भेजा जाता है.

Step 6: Test और iterate करें

  1. Telegram खोलें और अपने bot को उसके username से search करें.
  2. Conversation शुरू करने के लिए Start पर tap करें.
  3. Message भेजें और verify करें कि character सही तरीके से respond करता है.

इन बातों पर ध्यान दें:

  • क्या character कई exchanges के बाद भी character में रहता है?
  • क्या tone Telegram conversation के लिए सही है (short, conversational)?
  • क्या knowledge base references accurate हैं?
  • क्या response length messaging format के लिए appropriate है?

जो आप observe करते हैं उसके आधार पर AI Main Prompt, AI Guidelines, personality setting, और knowledge base content adjust करें. Character prompt engineering iterative होती है. Wording में छोटे changes भी model character को कैसे interpret करता है, इस पर significant असर डाल सकते हैं.

Multiple characters चलाना

अगर आप Telegram पर multiple roleplay characters offer करना चाहते हैं, तो आपके पास दो options हैं:

  1. Multiple Quickchat AI agents: हर character के लिए अलग AI agent create करें, प्रत्येक का अपना BotFather token हो. हर bot Telegram में अलग contact के रूप में दिखता है. यह best results देता है क्योंकि हर character का अपना dedicated context और knowledge base होता है.
  2. Character switching वाला single agent: एक agent का उपयोग करें जिसमें system prompt multiple characters define करता है और AI को user commands के आधार पर switch करने का instruction देता है. इसे manage करना सरल है, लेकिन कई personas के साथ character consistency degrade हो सकती है.

Telegram पर, option 1 natural fit है. हर bot अपना अलग contact है, और users हर character के साथ अलग conversations रख सकते हैं. Manage करने के लिए कोई shared server या channel नहीं है.

Common issues और fixes

कुछ messages के बाद bot character से बाहर आ जाता है: AI Main Prompt या AI Guidelines बहुत vague हो सकते हैं. अधिक specific behavioral rules add करें. Explicit guideline के रूप में “तुम्हें किसी भी हालत में character से बाहर नहीं आना है” जोड़ना अधिकांश models के साथ मदद करता है.

Responses Telegram के लिए बहुत लंबे हैं: Telegram conversations messaging जैसी महसूस होती हैं, novel पढ़ने जैसी नहीं. Response length specify करने वाली guideline add करें, उदाहरण: “Casual बातचीत में responses को 2-4 वाक्यों तक सीमित रखो.” Conversation Style settings में Reply Length को “Short” या “Normal” पर भी set करें.

Bot respond नहीं करता: Verify करें कि BotFather API token सही है और Telegram integration External Apps में enabled है. Telegram में bot खोलें और messages भेजने से पहले /start भेजें. अगर bot पहले काम कर रहा था और रुक गया, तो BotFather में token regenerate करें और dashboard में update करें.

Knowledge base answers character voice को override कर देते हैं: अगर bot lore questions का answer देते समय FAQ system जैसा सुनाई देने लगता है, तो ऐसी guideline add करें जो जोर दे कि सारी information character में deliver की जानी चाहिए. उदाहरण: “दुनिया के बारे में जानकारी देते समय, उसे factual reference की तरह नहीं, बल्कि अपने personal अनुभव से बताओ.”

Character casual prompt के बावजूद formal language use करता है: AI Personality को “Professional” या “Normal” के अलावा किसी और पर set करें. Character के अनुसार “Friendly” या “Sassy” try करें. यह भी check करें कि AI Main Prompt speech style को explicitly describe करता है (जैसे, “बिना punctuation के lowercase में बोलता है”).

Privacy और content considerations

Roleplay conversations में sensitive या personal creative content हो सकता है. ध्यान में रखने योग्य कुछ बातें:

  • AI को भेजे गए messages underlying LLM provider द्वारा process किए जाते हैं. Provider की data retention policies review करें.
  • Quickchat AI conversation data का उपयोग models train करने के लिए नहीं करता. Details के लिए privacy policy देखें.
  • AI user instructions की परवाह किए बिना अपनी content policy follow करेगा, इसलिए कुछ types का content refuse किया जा सकता है.
  • Telegram के 1-on-1 format का मतलब है कि conversations moderate करने के लिए कोई server admin नहीं है. अगर आप public bot deploy कर रहे हैं, तो bot के /start message में appropriate use के बारे में guidelines जोड़ने पर विचार करें.
  • अगर आपको data handling पर full control चाहिए, तो managed service का उपयोग करने के बजाय model self-host करने पर विचार करें.

तुलना: roleplay bots के लिए Telegram vs Discord

पहलूTelegramDiscord
Conversation format1-on-1 private chatServer channels/threads
User onboardingBot search करें, Start पर tap करेंServer join करें, channel खोजें, @mention
Multi-characterप्रति character separate botsSame server में multiple bots
Rich mediaStickers, inline keyboards, voiceEmbeds, reactions, threads
Group roleplayसंभव लेकिन awkwardChannels के साथ natural fit
PrivacyDefault रूप से privateDefault रूप से public या semi-public
Conversation persistenceSingle continuous threadThreads archived हो सकते हैं
किसके लिए सबसे अच्छा1-on-1 character interactionsGroup/community roleplay

दोनों platforms काम करते हैं. Telegram private, intimate character interactions के लिए बेहतर है. Discord community-driven, multi-player roleplay के लिए बेहतर है.

आगे पढ़ें

Quickchat AI Quickchat AI Ask Quickchat AI a question