{"id":13680351,"url":"https://github.com/flynnoct/chatgpt-telegram-bot","last_synced_at":"2025-04-29T23:31:14.384Z","repository":{"id":96955758,"uuid":"608435515","full_name":"flynnoct/chatgpt-telegram-bot","owner":"flynnoct","description":"Telegram bot implemented by OFFICIAL OpenAI ChatGPT API (gpt-3.5-turbo, released on 2023-03-01)","archived":false,"fork":false,"pushed_at":"2023-11-18T12:35:38.000Z","size":2840,"stargazers_count":180,"open_issues_count":12,"forks_count":43,"subscribers_count":4,"default_branch":"main","last_synced_at":"2024-11-11T23:37:23.637Z","etag":null,"topics":["chatgpt","openai","telegram","telegram-bot"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/flynnoct.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2023-03-02T02:18:31.000Z","updated_at":"2024-10-19T01:27:32.000Z","dependencies_parsed_at":"2023-11-18T13:37:12.958Z","dependency_job_id":null,"html_url":"https://github.com/flynnoct/chatgpt-telegram-bot","commit_stats":null,"previous_names":[],"tags_count":8,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/flynnoct%2Fchatgpt-telegram-bot","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/flynnoct%2Fchatgpt-telegram-bot/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/flynnoct%2Fchatgpt-telegram-bot/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/flynnoct%2Fchatgpt-telegram-bot/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/flynnoct","download_url":"https://codeload.github.com/flynnoct/chatgpt-telegram-bot/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251599965,"owners_count":21615613,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["chatgpt","openai","telegram","telegram-bot"],"created_at":"2024-08-02T13:01:16.231Z","updated_at":"2025-04-29T23:31:09.370Z","avatar_url":"https://github.com/flynnoct.png","language":"Python","funding_links":[],"categories":["Python"],"sub_categories":[],"readme":"# ChatGPT Bot for Telegram\n\n![](/docs/dialog.png)\n\n## 💥 Read This Before Updating to v1.4\n\nWe adjusted configuration format since v1.4.0, which is NOT compatible with previous versions. Please check the [config doc](./docs/config_file.md) for more details. You should backup your old config file and create a new one after updating to v1.4.0.\n\n## 🎉 News\n\n- **Microsoft Azure TTS** is now supported! The Bot can now reply with voice messages!\n- **ChatGPT temperature** is now supported! You can set the temperature in configuration to customize the creativity of ChatGPT reply.\n- A better **logging system** is provided for debugging purposes.\n- A better-organized config structure is provided. You should go through the [config doc](./docs/config_file.md) and modify the config file. We have temporarily removed the `config.py` configuration script.\n- Model selection ability is added. You can now choose the model you want to use in the config file. The Bot can be powered by GPT-4 if you have access.\n\n## 🐱 Introduction\n\nChatGPT Bot for Telegram is implemented with [OpenAI ChatGPT API](https://platform.openai.com/docs/guides/chat) released on March 1, 2023. The Telegram integration framework is based on [python-telegram-bot](https://python-telegram-bot.org).\n\nChatGPT Bot can act as your Telegram contact. You can chat with it personally, share with a contact, and collabrate in a group chat. We attach great importance to privacy protection and make sure the Bot can't acquire any unrelated messages in group chats.\n\nThe Bot shares knowledge and inspires exciting new ideas. Many interesting features, such as **DALL·E** and **Whisper** are integrated together to make our Bot smarter and more usable.\n\nWe hope you enjoy it!\n\n## 🌟 Features\n\nThe Telegram Bot features the following functions:\n\n- **ChatGPT, the AI consultant**. You can customize the Bot's character according to preference.\n- **DALL·E, the Image Generation AI Model**. Send a short prompt to the Bot and get your own painting.\n- **Whisper, the Intelligent Speech Recognizer**. The Bot can read your voice messages.\n- **Azure TTS, the Speech service feature that converts text to lifelike speech**. The Bot can reply with voice messages.\n- **Comprehensive Privacy Protection**. The Bot is unable (and of course we won't) to collect any message in group chat except user prompts.\n\nAdditonal features:\n\n- ChatGPT role and temperature Customization.\n- The Telegram _inline mode_ allows you to query the Bot privately in a chat with a contact or group, even if the Bot is not a member.\n- User White-list to control who can use the Bot. You can also set `allow_all_users` to `true` to allow any users to use the Bot.\n- Set the daily limitation of requirements to **DALL·E**.\n- Grant more resources to _Super Users_.\n- Docker deployment is supported. (This method is maintained by community. Thanks for @EstrellaXD 's contribution)\n\n## 👷 Deploy Your Own\n\n### Preparation\n\n1. Create a Telegram Bot by [@BotFather](https://t.me/BotFather) and get the token.\n2. Create an OpenAI account and get the API key.\n3. A Linux VM or a server with Python 3 is needed to run the Bot.\n4. A practical Internet environment is required.\n5. (Optional) [FFmpeg](https://ffmpeg.org) is required for the Bot to handle voice messages with Whisper. If you are not interested in using voice messages, you don't need to install it and **must set `enable_voice` in the config file to False**.\n6. (Optional) [Azure TTS SDK](https://learn.microsoft.com/en-us/azure/cognitive-services/speech-service/quickstarts/setup-platform?pivots=programming-language-python\u0026tabs=linux) is required for the Bot to reply with voice messages.\n\n### Installation\n\n1. Git clone from main branch or download the latest release [Source code](https://github.com/flynnoct/chatgpt-telegram-bot/releases/latest) file and install the dependencies.\n\n```bash\ngit clone https://github.com/flynnoct/chatgpt-telegram-bot.git\ncd chatgpt-telegram-bot\npip install -r requirements.txt\n```\n\n2. Create a config file to manage the Bot.\n\nThe config file includes sensitive information, such as telegram_token and openai_api_key, and we only release the corresponding template `config.json.template`. Therefore, you need to create a new `config.json` file by replacing the relative fields in the template with your own.\n\n```bash\ncp config.json.template config.json\n```\n\n**Recommended:** You should keep `config.json.template` unmodified because the Bot needs to read default configuration values from it. For backward compatibility, it is highly recommended to check the template for newly added parameters when you update to a new version.\n\nFor more details, see [documentation](docs/config_file.md).\n\n3. Run the Bot with `start_bot.sh` and try talk to it. You can also use docker to run the Bot.\n\n```bash\n# First, make sure you are in the root directory of the project,\n# aka \u003cyour_download_location\u003e/chatgpt-telegram-bot\nbash ./bin/start_bot.sh # start the Bot\n\n# Use docker compose to run the Bot\ndocker compose up -d\n```\n\nTo clear ChatGPT conversation context and restart the Bot, run shell script `restart_bot.sh`. To shut down the Bot, run `stop_bot.sh`.\n\n```bash\nbash ./bin/restart_bot.sh # restart the Bot\nbash ./bin/stop_bot.sh # stop the Bot\n```\n\nUp to now, you have successfully deployed the Bot.\n\n### Usage\n\nThe Bot works in both personal and group chat of Telegram.\nIn a personal chat, simply send a message to the Bot and it will reply to you.\nIn a group chat, use the `/chat` to invoke the Bot. \n\nIn a personal chat with a contact, use `@your_bot_name \u003cyour messages\u003e` to invoke the Bot with Telegram inline mode. Both you and your contact can see the Bot's reply in the chat. \n\n1. The following commands are supported:\n\n- `/start`: Start the Bot.\n- `/role \u003cprompt\u003e`: Set role for conversation.\n- `/chat` : Invoke the Bot in group chat.\n- `/dalle \u003cprompt\u003e`: Ask DALL·E for a painting based on your prompt.\n- `/clear`: Clear the conversation context.\n- `/getid`: Get your Telegram user ID.\n\n(Optinal) You can set them up as Telegram Bot command, see [here](https://core.telegram.org/bots/tutorial#creating-your-command).\n\n2. Inline mode\n\nTo enable inline mode, see [here](https://core.telegram.org/bots/api#inline-mode). \n\nType `/mybots` \u003e Your_Bot_Name \u003e Bot Settings \u003e Inline Feedback, you must set the `Inline Feedback` to 100%.\n\n\n### TroubleShooting\n\nSee [documentation](./docs/troubleshooting.md).\n\n## 🧑‍💻 For developers\n\nDocumentation is provided under [docs](./docs) for developers who wants to customize the Bot.\n\n## 📚 Release Notes\n\nThe latest released version is [here](https://github.com/flynnoct/chatgpt-telegram-bot/releases/latest).\n\nThe release notes are [here](/docs/release_notes.md).\n\nMore interesting new features are coming soon!\n\n## 🪪 License\n\n[MIT](LICENSE.md)\n\n## ☕️ Buy Me a Coffee (not Java)\n\nIf you like this project, you can buy me a coffee ❤️ or give this repository a free star ⭐️.\n\nClick [Alipay](docs/donate_code/alipay.jpg) to open QR code.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fflynnoct%2Fchatgpt-telegram-bot","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fflynnoct%2Fchatgpt-telegram-bot","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fflynnoct%2Fchatgpt-telegram-bot/lists"}