Skip to content

Project: AI-Powered Telegram Bot with Web Dashboard. Created at https://spectra.codes, which is owned by @Drix10

Notifications You must be signed in to change notification settings

coslynx/ai-telegram-bot-dashboard

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

51 Commits
Β 
Β 
Β 
Β 

Repository files navigation


ai-telegram-bot-dashboard

AI-powered Telegram bot with a comprehensive web dashboard for managing and enhancing AI-assisted conversations and content analysis.

Developed with the software and tools below.

Framework used Frontend technologies used Backend technology used AI technologies used

git-last-commit GitHub commit activity GitHub top language

πŸ“‘ Table of Contents

  • πŸ“ Overview
  • πŸ“¦ Features
  • πŸ“‚ Structure
  • πŸ’» Installation
  • πŸ—οΈ Usage
  • 🌐 Hosting
  • πŸ“„ License
  • πŸ‘ Authors

πŸ“ Overview

This repository houses the "ai-telegram-bot-dashboard" project, which brings together the power of AI and Telegram to provide a sophisticated communication and automation platform. The project features a robust web dashboard that allows for seamless management and configuration of the AI-powered bot.

πŸ“¦ Features

Feature Description
βš™οΈ Architecture The project's architecture is designed for modularity, scalability, and maintainability, with separate components for bot logic, web dashboard, and AI integration.
πŸ“„ Documentation This README file provides a comprehensive overview of the project, its features, dependencies, and instructions for installation and usage.
πŸ”— Dependencies The project leverages a range of popular libraries and packages, including Next.js, Express.js, Prisma, OpenAI, and LangChain, to ensure efficient development and integration.
🧩 Modularity The codebase is structured modularly, with distinct directories for frontend (web dashboard), backend (API), and telegram bot functionalities. This approach facilitates easier code maintenance and allows for efficient expansion.
πŸ§ͺ Testing Thorough testing is implemented to ensure the reliability and robustness of the codebase, utilizing frameworks like Jest.
⚑️ Performance Performance optimization strategies are employed to ensure a smooth and responsive user experience, including caching, database optimization, and efficient resource utilization.
πŸ” Security Robust security measures are implemented to protect sensitive user data and ensure secure communication. These measures include input validation, data encryption, and regular security audits.
πŸ”€ Version Control The project utilizes Git for version control, with GitHub Actions workflow files for automated build and release processes.
πŸ”Œ Integrations The platform integrates with various services and APIs, including the Telegram Bot API, OpenAI API, weather APIs, news APIs, image processing APIs, and translation APIs.
πŸ“Ά Scalability The project is designed for scalability to handle increased user loads and data volumes, leveraging cloud-based infrastructure and database optimizations.

πŸ“‚ Structure

β”œβ”€β”€ src
β”‚   β”œβ”€β”€ telegram
β”‚   β”‚   β”œβ”€β”€ utils
β”‚   β”‚   β”‚   └── bot.ts
β”‚   β”‚   β”œβ”€β”€ services
β”‚   β”‚   β”‚   └── openai.service.ts
β”‚   β”‚   β”œβ”€β”€ types
β”‚   β”‚   β”‚   └── types.ts
β”‚   β”‚   β”œβ”€β”€ commands
β”‚   β”‚   β”‚   β”œβ”€β”€ help.ts
β”‚   β”‚   β”‚   β”œβ”€β”€ start.ts
β”‚   β”‚   β”‚   └── translate.ts
β”‚   β”‚   β”œβ”€β”€ events
β”‚   β”‚   β”‚   └── message.ts
β”‚   β”‚   └── index.ts
β”‚   β”‚       └── constants.ts
β”‚   β”œβ”€β”€ web
β”‚   β”‚   β”œβ”€β”€ api
β”‚   β”‚   β”‚   β”œβ”€β”€ controllers
β”‚   β”‚   β”‚   β”‚   β”œβ”€β”€ user.controller.ts
β”‚   β”‚   β”‚   β”‚   β”œβ”€β”€ admin.controller.ts
β”‚   β”‚   β”‚   β”‚   β”œβ”€β”€ image.controller.ts
β”‚   β”‚   β”‚   β”‚   β”œβ”€β”€ conversation.controller.ts
β”‚   β”‚   β”‚   β”‚   └── bot.controller.ts
β”‚   β”‚   β”‚   β”œβ”€β”€ middlewares
β”‚   β”‚   β”‚   β”‚   β”œβ”€β”€ auth.middleware.ts
β”‚   β”‚   β”‚   β”‚   └── validate.middleware.ts
β”‚   β”‚   β”‚   β”œβ”€β”€ services
β”‚   β”‚   β”‚   β”‚   β”œβ”€β”€ user.service.ts
β”‚   β”‚   β”‚   β”‚   β”œβ”€β”€ image.service.ts
β”‚   β”‚   β”‚   β”‚   β”œβ”€β”€ conversation.service.ts
β”‚   β”‚   β”‚   β”‚   └── bot.service.ts
β”‚   β”‚   β”‚   └── routes.ts
β”‚   β”‚   β”œβ”€β”€ pages
β”‚   β”‚   β”‚   β”œβ”€β”€ admin
β”‚   β”‚   β”‚   β”‚   β”œβ”€β”€ dashboard
β”‚   β”‚   β”‚   β”‚   β”‚   └── index.tsx
β”‚   β”‚   β”‚   β”‚   β”œβ”€β”€ users
β”‚   β”‚   β”‚   β”‚   β”‚   └── index.tsx
β”‚   β”‚   β”‚   β”‚   └── settings
β”‚   β”‚   β”‚   β”‚       └── index.tsx
β”‚   β”‚   β”‚   β”œβ”€β”€ auth
β”‚   β”‚   β”‚   β”‚   └── login.tsx
β”‚   β”‚   β”‚   β”œβ”€β”€ conversations
β”‚   β”‚   β”‚   β”‚   └── index.tsx
β”‚   β”‚   β”‚   └── index.tsx
β”‚   β”‚   β”œβ”€β”€ config
β”‚   β”‚   β”‚   └── env.ts
β”‚   β”‚   β”œβ”€β”€ app.tsx
β”‚   β”‚   β”œβ”€β”€ db.ts
β”‚   β”‚   β”œβ”€β”€ utils
β”‚   β”‚   β”‚   β”œβ”€β”€ error.ts
β”‚   β”‚   β”‚   β”œβ”€β”€ logger.ts
β”‚   β”‚   β”‚   └── response.ts
β”‚   β”‚   β”œβ”€β”€ types
β”‚   β”‚   β”‚   β”œβ”€β”€ types.ts
β”‚   β”‚   β”‚   └── user.ts
β”‚   β”œβ”€β”€ core
β”‚   β”‚   β”œβ”€β”€ config
β”‚   β”‚   β”‚   └── openai.config.ts
β”‚   β”‚   β”œβ”€β”€ utils
β”‚   β”‚   β”‚   β”œβ”€β”€ string.ts
β”‚   β”‚   β”‚   β”œβ”€β”€ time.ts
β”‚   β”‚   β”‚   └── logger.ts
β”‚   β”‚   β”œβ”€β”€ types
β”‚   β”‚   β”‚   └── types.ts
β”‚   β”‚   └── constants.ts
β”‚   β”œβ”€β”€ models
β”‚   β”‚   β”œβ”€β”€ User.ts
β”‚   β”‚   β”œβ”€β”€ Conversation.ts
β”‚   β”‚   └── Image.ts
β”‚   └── prisma
β”‚       └── schema.prisma
β”œβ”€β”€ .eslintrc.js
β”œβ”€β”€ tsconfig.json
β”œβ”€β”€ next.config.js
β”œβ”€β”€ tailwind.config.js
└── package.json

πŸ’» Installation

πŸ”§ Prerequisites

  • Node.js
  • npm
  • Docker

πŸš€ Setup Instructions

  1. Clone the repository:
    • git clone https://github.com/spectra-ai-codegen/ai-telegram-bot-dashboard.git
  2. Navigate to the project directory:
    • cd ai-telegram-bot-dashboard
  3. Install dependencies:
    • npm install

πŸ—οΈ Usage

πŸƒβ€β™‚οΈ Running the Project

  1. Start the development server:
    • npm start
  2. Open your browser and navigate to http://localhost:3000.

βš™οΈ Configuration

Adjust configuration settings in config.js or .env.

πŸ“š Examples

  • πŸ“ Example 1: Send a text message to the bot and receive an AI-generated response.
  • πŸ“ Example 2: Utilize the image processing features to extract text from an image or generate a caption for an image.
  • πŸ“ Example 3: Access the web dashboard to manage bot settings, monitor bot usage, and configure user access.

🌐 Hosting

πŸš€ Deployment Instructions

Docker and Cloud Deployment

  1. Build the Docker image:
    • docker build -t ai-telegram-bot-dashboard .
  2. Run the Docker container:
    • docker run -p 3000:3000 ai-telegram-bot-dashboard

Heroku

  1. Install the Heroku CLI:
    • npm install -g heroku
  2. Login to Heroku:
    • heroku login
  3. Create a new Heroku app:
    • heroku create
  4. Deploy the code:
    • git push heroku main

πŸ”‘ Environment Variables

  • TELEGRAM_BOT_TOKEN: Your Telegram bot token
  • OPENAI_API_KEY: Your OpenAI API key
  • DATABASE_URL: Your database connection URL

πŸ“œ API Documentation

πŸ” Endpoints

  • GET /api/bot/messages: Retrieves a list of messages sent to the bot.
  • POST /api/bot/messages: Sends a message to the bot.
  • GET /api/admin/users: Retrieves a list of users.
  • POST /api/admin/users: Creates a new user.

πŸ”’ Authentication

Use JWT tokens for authentication.

πŸ“ Examples

  • curl -X GET http://localhost:3000/api/bot/messages

πŸ“œ License

This project is licensed under the GNU AGPLv3.

πŸ‘₯ Authors

  • Author Name - Spectra.codes

  • Creator Name - DRIX10

    🌐 Spectra.Codes

    Why only generate Code? When you can generate the whole Repository!