References to the documentation of the key libraries:
Alternative libraries and tools that might offer more features or better performance:
- python-telegram-bot: A more extensive Telegram bot framework that also supports asynchronous mode.
- aiogram: A modern framework for building Telegram bots using Python with asynchronous mode (async/await).
- Hugging Face's Transformers: If you're looking to host GPT models locally without relying on the OpenAI API.
-
Clone the Repository:
git clone https://github.com/Ayshyama/TelegramBot-ChatGPT.git cd TelegramBot-ChatGPT
-
** Install the Required Libraries**: The repository contains a requirements.txt file that lists all the necessary libraries. Install them using pip:
pip install -r requirements.txt
- Get the Telegram Bot Token:
- Go to the Telegram App and search for the "BotFather" bot.
- Start a chat with BotFather and follow the instructions to create a new bot.
- Once the bot is created, BotFather will provide you with a token. This token is used to access the Telegram API.
- Get the OpenAI API Key:
- Sign up on the OpenAI platform.
- Navigate to the API section to generate an API key.
- Update the Code: Open the singularity_bot.py file and set the following:
- Replace the empty string in bot = telebot.TeleBot("") with your Telegram bot token.
- Replace the empty string in openai.api_key = "" with your OpenAI API key.
- Run the Bot:
python singularity_bot.py
- Interact with the Bot:
- Go to the Telegram app, search for your bot's username, and start a chat.
- Send the /start command to initiate the conversation.