Skip to content

soubhagyajit/Telegram-bot

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Telegram Bot

This is a simple Telegram chatbot made using Python. The chatbot utilizes the OpenAI API for answering questions and managing conversations.

Prerequisites

To run this Telegram chatbot, you need to have the following prerequisites installed:

  • Python 3.6 or higher
  • python-telegram-bot library (pip install python-telegram-bot==13.7)
  • OpenAI library (pip install openai==0.28)
  • ulrlib version 1.26.15 (pip install urllib3==1.26.15)

You also need to obtain an API key from OpenAI. You can sign up for an API key on the OpenAI website.

Setup

  1. Clone the repository to your local machine or download the source code.
  2. Install the required dependencies as mentioned in the prerequisites section.
  3. Replace YOUR_OPENAI_API_KEY in the telegram_bot.py file with your actual OpenAI API key.
  4. Run the telegram_bot.py file using the command python telegram_bot.py.
  5. Find your bot on Telegram and start chatting!

Usage

Once the bot is up and running, you can start a conversation with it on Telegram. The bot will listen for incoming messages and respond accordingly.

You can ask the bot questions, and it will utilize the OpenAI API to generate responses based on the conversation context. The bot can handle multiple turns of conversation and maintain context between messages.

Customization

You can customize the behavior of the chatbot by modifying the telegram_bot.py file. Here are some possible customizations:

  • Adjust the OpenAI API parameters to change the response generation behavior.
  • Add additional logic to handle specific commands or questions.
  • Implement conversation history storage to maintain context across different sessions.

Feel free to explore and modify the code to suit your needs.

Limitations

  • The chatbot's responses are dependent on the quality and accuracy of the OpenAI API. It may not always provide the desired or expected answers.
  • The bot may have limitations in understanding and responding to complex or ambiguous queries.
  • The code provided is a simple implementation and may not cover all possible edge cases or error handling scenarios. It can serve as a starting point for further development and improvement.

License

This project is licensed under the MIT License.

Acknowledgments

  • The Python Telegram Bot library: python-telegram-bot
  • OpenAI for providing the powerful API for natural language processing.

Releases

No releases published

Packages

No packages published

Languages