Welcome to the Workshop Telegram Bots with AI Template! This repository is a template designed for building a Telegram bot using AI through the Vercel SDK. The bot is tailored for a hair salon appointment booking system.
To create your own repository from this template:
- Click on the Use this template button on the repository's GitHub page.
- Select your account or organization and give your new repository a name.
- Click Create repository from template.
You can set up your development environment using GitHub Codespaces or locally with Docker and VSCode.
- Open your newly created repository on GitHub.
- Click on the Code button and then Open with Codespaces.
- Create a new Codespace to launch the development environment.
The devcontainer will automatically install dependencies and set up the environment for you.
To run the project locally, ensure you have Docker and Visual Studio Code (VSCode) with the Dev Containers extension installed.
- Clone your repository:
git clone https://github.com/your-username/your-repository-name.git cd your-repository-name
- Open the project in VSCode and choose Reopen in Container when prompted.
- Docker will automatically build the container and install the dependencies.
You need to create a .env file with the necessary environment variables. Copy the provided .env.example file and fill in the values.
cp .env.example .env
Update the .env file with your Telegram Bot Token, Postgres Database URL, OpenAI API Key, and AI Model information.
Example .env:
BOT_TOKEN=your-telegram-bot-token
DATABASE_URL=postgres://postgres:postgres@localhost:5432/postgres
OPENAI_API_KEY=your-openai-api-key
MODEL=ollama:qwen-2_5
MODEL_EMBEDDING=ollama:nomic-embed-text
Before running the bot, you’ll need to set up the PostgreSQL database and apply migrations.
-
Generate the database schema:
pnpm run db:generate
-
Run the database migrations:
pnpm run db:migrate
-
Optionally, you can use the drizzle studio to visualize the database schema:
pnpm run db:studio
To start the bot in development mode, use the following command:
pnpm run dev
This will watch for changes in the source code and restart the bot automatically.
Project Structure
Contributing
Feel free to fork this repository and make your own changes. Contributions are welcome!
License
This project is licensed under the EPL-2.0 License. See the LICENSE file for more details.