Skip to content

Personal ChatGPT Telegram Bot⚓︎

Introducing the ultimate AI-powered chatbot for Telegram - the perfect companion for anyone looking for quick, accurate answers to their questions. Our bot uses state-of-the-art machine learning technology powered by the ChatGPT model, allowing it to understand natural language inputs and respond with human-like precision.

With our bot, you can ask anything you want, from simple queries to complex questions. Whether you're looking for information on the latest news, need help with a math problem, or just want to chat with a virtual friend, our bot has you covered.

What's more, our bot is designed to be easy to use and user-friendly. Simply type in your question or query, and the bot will do the rest, providing you with a quick and accurate response in seconds. No more scrolling through endless search results or struggling to find the information you need - our bot does all the hard work for you.

So why wait? Try out our ChatGPT-powered Telegram bot today and experience the future of AI-powered chatbots for yourself!

(с) Generated by ChatGPT

But seriously, the project uses your ChatGPT token to access the ChatGPT API and let you chat with ChatGPT directly in Telegram.

Disclaimer

This is a personal project and is not affiliated with OpenAI in any way.

Demo⚓︎

See for yourself how easy and convenient it is to use ChatGPT in Telegram. It is better to see once than to hear 100 times.

Features⚓︎

Key Features:

  • Saving the context of a conversation
  • 🆕 Access can be restricted by specifying a list of allowed users.
  • 🆕 Support for multiple chats for one user
  • Support markdown in answers
  • 🆕 Ability to set behavior for the conversation, which will be preserved even when the context is cleared
  • Docker and Proxy support
  • 🆕 Possibility to check expenses for the current month
  • 🆕 Tells you how many tokens you spent to generate a response
  • 🆕 Support Telegram Inline Mode

Commands⚓︎

List of available commands to control the bot.

Chat commands⚓︎

/chat chat_name - allows you to create a new chat or switch to an existing one.

/chat - allows you to return to normal chat. Also displays a list of created chats.

/close_chat - closes the chat room. You get to the default chat room.

/clear_context - clears the chat context. In fact, it deletes the chat and creates a new one. The behavior is maintained, as opposed to closing the chat room.

/prompt your_question - Allows you to ask a question outside the context of the main conversation.

/current_chat - returns the name of the current chat.

Behavior commands⚓︎

In fact, the first message at the beginning of the chat, which tells how the AI should react. It is saved when the context is cleared, but is not saved when the chat is closed.

These commands work within the current chat, and do not affect other chats.

/behavior behavior_description - sets the bot's behavior for the current chat.

/current_behavior - get the current behavior setting for the current chat.

/clear_behavior - removes the behavior settings for the current chat.

Other commands⚓︎

/balance - Allows you to see the amount of money spent this month. Works only when you specify bot admins.

Inline Mode⚓︎

Inline mode allows you to use the bot in group chat, private chat, or in comments. Here's how it works:

But for this mode to work it needs to be set up:

setinlinefeedback

Be sure to activate /setinlinefeedback, otherwise nothing will work.

Privacy⚓︎

See my last name in the domain? I'm a developer, blogger, and publicly active. I don't have the benefit of getting dirty under my own name. I assure you that your data is not transferred to third parties, even I do not know about your requests to ChatGPT. You can see for yourself by examining the code, it's opensource.

Let's get started⚓︎

Enough words, let's launch your personal ChatGPT Telegram bot. 🚀

Preparing⚓︎

Environment variables⚓︎

  • TELEGRAM_BOT_TOKEN - The bot access token you got from GodFather. Example: 1234567890:XXX_XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
  • TELEGRAM_BOT_USERNAME - Specify a name with the ending bot here, not a public name. Example: Undusted_bot
  • TELEGRAM_PERSON_ID - The IDs of the users on Telegram who are allowed access. Example: 1234567, 56789045
  • ADMIN_TELEGRAM_PERSON_ID - The IDs of the users on Telegram who are allowed admin access. Example: 1234567
  • CHAT_GPT_TOKEN - OpenAI API access token.

Docker Run⚓︎

Support

The following platforms are supported: linux/amd64, linux/arm64/v8

docker run -it --name chatgpt-telegram-bot \
    --env TELEGRAM_BOT_TOKEN= \
    --env TELEGRAM_BOT_USERNAME= \
    --env TELEGRAM_PERSON_ID= \
    --env ADMIN_TELEGRAM_PERSON_ID= \
    --env CHAT_GPT_TOKEN= \
    upagge/chatgpt-telegram-bot:develop

Telegram Proxy⚓︎

If you have Telegram blocked, you can specify proxy settings to connect.

Note

Requests to OpenAI will not be made through a proxy

docker run -it --name chatgpt-telegram-bot \
    --env TELEGRAM_BOT_TOKEN= \
    --env TELEGRAM_BOT_USERNAME= \
    --env TELEGRAM_PERSON_ID= \
    --env ADMIN_TELEGRAM_PERSON_ID= \
    --env CHAT_GPT_TOKEN= \
    --env TELEGRAM_PROXY_ENABLE=true \
    --env TELEGRAM_PROXY_HOST= \
    --env TELEGRAM_PROXY_PORT= \
    --env TELEGRAM_PROXY_TYPE=SOCKS5 \
    --env TELEGRAM_PROXY_USERNAME= \
    --env TELEGRAM_PROXY_PASSWORD= \
    upagge/chatgpt-telegram-bot:latest
  • Available options SOCKS5, SOCKS4, HTTP.
  • Optional. If there is no authorization, you can leave it blank.

DockerCompose⚓︎

Don't forget to create a file with the variable .env.

version: '3.8'
services:

  chat-gpt:
    image: upagge/chatgpt-telegram-bot:latest
    container_name: chatgpt-bot
    restart: always
    environment:
      TELEGRAM_BOT_TOKEN: ${TELEGRAM_BOT_TOKEN}
      TELEGRAM_BOT_USERNAME: ${TELEGRAM_BOT_USERNAME}
      TELEGRAM_PERSON_ID: ${TELEGRAM_PERSON_ID}
      ADMIN_TELEGRAM_PERSON_ID: ${ADMIN_TELEGRAM_PERSON_ID}
      CHAT_GPT_TOKEN: ${CHAT_GPT_TOKEN}
TELEGRAM_BOT_TOKEN=
TELEGRAM_BOT_USERNAME=
TELEGRAM_PERSON_ID=
ADMIN_TELEGRAM_PERSON_ID=
CHAT_GPT_TOKEN=

❤ Support Develop⚓︎

Sponsorship makes a project sustainable because it pays for the time of the maintainers of that project, a very scarce resource that is spent on developing new features, fixing bugs, improving stability, solving problems, and general support. The biggest bottleneck in Open Source is time.

  • Bank card for residents of the Russian Federation: https://www.tinkoff.ru/cf/4iU6NB3uzqx
  • Crypto:
    • TON: struchkov-mark.ton
    • BTC (Taproot): bc1pt49vnp43c4mktk6309zlq3020dzd0p89gc8d90zzn4sgjvck56xs0t86vy
    • ETH: 0x7668C802Bd71Be965671D4Bbb1AD90C7f7f32921
      • USDT (ERC-20): 0x7668C802Bd71Be965671D4Bbb1AD90C7f7f32921
      • DAI (ERC-20): 0x7668C802Bd71Be965671D4Bbb1AD90C7f7f32921
    • BNB: 0xDa41aC95f606850f2E01ba775e521Cd385AA7D03
      • USD: 0xDa41aC95f606850f2E01ba775e521Cd385AA7D03
      • DAI: 0xDa41aC95f606850f2E01ba775e521Cd385AA7D03

FAQ⚓︎

What model is used?

For now the gpt-3.5-turbo model is used. In future versions you will be able to choose the model.

What happens if my reply is longer than the allowed number of characters in one Telegram message?

That's okay, the answer will be broken up into several posts.

Other Questions⚓︎

If you don't understand something, you can ask a question here 👇 or in a discussion on GitHub.

Comments