A Telegram bot using OpenAI and Telegram API.
- Node.js >= 14.0.0
- Telegram Bot Token
- OpenAI API Key
-
Clone the repository:
git clone https://github.com/RostyslavDzhohola/family-tele-chatGPT.git cd family-tele-chatGPT
-
Install dependencies:
npm install
-
Create a
.env
file in the root directory and add your credentials:TELEGRAM_BOT_TOKEN=your-telegram-bot-token OPENAI_API_KEY=your-openai-api-key
-
Create a bot with Telegram BotFather to get the
TELEGRAM_BOT_TOKEN
. You can contact BotFather here. -
Add the bot to a chat group and give it admin permissions to enable it to work in group chats.
Start the bot with:
npm start
/start
- Welcome message/help
- List of commands- Mention the bot (
@your_bot_name
orname
) to ask questions.
-
Install the Heroku CLI using Homebrew:
brew tap heroku/brew && brew install heroku
brew tap heroku/brew
: Adds the Heroku repository to Homebrew.brew install heroku
: Installs the Heroku CLI.
-
Log in to Heroku:
heroku login
-
Create a new Heroku app:
heroku create
-
Add your environment variables to Heroku:
heroku config:set TELEGRAM_BOT_TOKEN=your-telegram-bot-token heroku config:set OPENAI_API_KEY=your-openai-api-key
-
Deploy the app:
git push heroku main
-
Scale the worker:
heroku ps:scale worker=1
-
Open the app:
heroku open
These instructions are tailored for macOS users. If you are using a different operating system, please refer to the appropriate installation instructions for the Heroku CLI on the Heroku Dev Center.