khlebobul / Digest-Telegram-Bot

Repository from Github https://github.comkhlebobul/Digest-Telegram-BotRepository from Github https://github.comkhlebobul/Digest-Telegram-Bot

Contributors Forks Stargazers Issues MIT License


Logo

Digest Telegram Bot

Generate digests for your Tg-channel in several seconds!
View Demo · Report Bug · Request Feature

Table of Contents
  1. About The Project
  2. Getting Started
  3. Usage
  4. Roadmap
  5. Contributing
  6. Team 49
  7. Detailed User Guide
  8. License
  9. Contact
  10. Acknowledgments

About The Project

Launching Screen Generate Screen Digest Screen

During the Software Project course in Innopolis University Team 49 has collaborated with customer Gleb Shalimov to create a Digest Telegram Bot that generates digests of channel posts using LLM.

Key features 🌟:

  • Digest period (week, 2 weeks, month, custom)
  • Channel selection
  • Main digest language (Ru/Eng)
  • Second digest language (Ru/Eng/none)
  • Publish to the channel
  • Bot language (Ru/Eng)
  • Choice between YaGPT and 01-ai/Yi-1.5-34B-Chat models

Back to Top

Built With

The DigestTelegramBot was built using:

  • Python
  • Aiogram
  • SQLite
  • YaGPT

Back to Top

Getting Started

Follow these simple steps to get a local copy and run it on your machine! 📦

Prerequisites

  • Python 3.10 or higher;
  • Telegram account;
  • git installed;
  • pip (Python package installer) installed.
  • Bot created in @BotFather.

Installation

Copy and paste it to your terminal.

  1. Clone the repo.
    git clone https://gitlab.pg.innopolis.university/i.ershov/digestBot.git
  2. Create a virtual inviroment.
    python3 -m venv venv
  3. Activate the virtual environment.
  • For Windows:
    venv\Scripts\activate
  • For macOS and Linux:
    source venv/bin/activate
  1. Install the required packages.
   pip install -r requirements.txt
  1. Configure environment variables

Create a .env file in the project root directory and add your Telegram bot token (is given in a message after creation by @BotFather):

   BOT_TOKEN=your_telegram_bot_token

Back to Top

Usage

To run the bot:

  1. Download the Docker Desktop;
  2. Write to console:
   docker build -t digest:latest --platform linux/amd64 .
    docker compose down
    docker compose up
  docker logs digestbot-digest-bot-service-1 --follow

Back to Top

Roadmap

  • Set up a bot
  • Create the landing message for the bot
  • Make the bot read messages
  • Integrate LLM
  • Make the bot send summaries to the channel
  • Configure and deploy the server for the bot operations
  • Implement Button Instructions for Enhanced Telegram Bot UX
  • Implement Databases for Telegram channels
  • Create Telegram channels and start Testing
  • Implement Databases for Telegram channels
  • Implement secure bot admin verification
  • Set up inviroment variables
  • Design database for channel posts
  • Implement customisable settings
  • Customise interface language
    • Russian
    • English
    • Others
  • Enable option to add personal LLM API Key
  • Configure language of posts in the channel
  • Add variety of digests periods
  • Add second language in digest
  • Add preview text for the digest
  • Deploy the new version
  • Add automatic digest publishing
  • Switch to free LLM 01-ai/Yi-1.5-34B-Chat
  • Add ability of user to change prompt
  • Implement monetization
  • Create donate button

See the open issues for a full list of proposed features (and known issues).

Back to Top

Contributing

  1. Fork the repository (click the "Fork" button in the upper-right corner of the repository page.)
  2. Create a new branch.
   git checkout -b feature/your-feature-name
  1. Stash files with changes.
  • Some files:
git add path/to/your/file1.py path/to/your/file2.py
  • All files:
 git add .
  1. Commit staged files.
   git commit -m 'Add some feature'
  1. Push to the branch.
   git push origin feature/your-feature-name
  1. Open a pull request (In repository page: Merge Requests -> New merge request, select Source branch with changes, select Target branch to apply changes on, review changes, provide title and detailed description.)

Back to Top

Team 49

  • Ivan Ershov - bot architect, project administrator, software engineer, techical support, contributor;
  • Timur Salakhov - bot architect, database engineer, quality assurance engineer, contributor;
  • Lana Ermolaeva - technical writer, prototype designer, contributor;
  • Anastasia Mitiutneva - team coordinator, technical writer, prompt engineer, contributor;
  • Ivan Makarov - videographer, tester, contributor;
  • Anastasia Surikova - architectural documenter, tester, contributor.

Back to Top

Detailed User Guide

Step-by-step instruction of how to use the DigestTelegramBot 👇:

  1. Add bot as an admin to your channel:
  • Go to your Telegram channel Info;
  • Click on "Administrators";
  • Click on "Add Admin";
  • Select DigestBot (@DigestTelegrambot);
  • Allow the bot to "Manage Messages";
  • Click "Done".
  1. Publish posts;
  2. Go to DigestBot (@DigestTelegrambot);
  3. Set up the languages in digest::
    1. Click on "⚙️Settings"
    2. Select channel for digest;
    3. Select "🌍Main language" to view or change the first language in digest (Ru/Eng);
    4. Click "⬅️Back" after selection is done to return to language preferences;
    5. Select "🌎Additional language" to view or change the second language in digest (Ru/Eng/without);
    6. Click "⬅️Back" after selection is done to return to language preferences;
    7. Click "⬅️Back" to return to the main keyboard.
  4. Create digest:
    1. Click "✍🏼Create digest";
    2. Click on one name of your channeles available (if none are displayed, you need to go throught guide steps 1 and 2);
    3. Click on one of the digest periods available or click on "Custom period" and send the number of days.
  5. Work with generated digest:
    • Click "✅Approve" to sent the digest to your channel;
    • Click "✏️Edit" to edit and pubslish the final version:
      1. Copy the digest;
      2. Rewrite parts;
      3. Send the final version as a message in the bot chat;
      4. Click "✅Approve" to sent the digest to your channel.
    • Click "🔄Regenerate" to get the alternative digest;
    • Click "❌Cancel" to return to the main keyboard.

⚠️ How to deal with bugs and errors?

  • The bot is stuck/digest is not generating:

    1. Check the internet connection;
    2. Check the Telegram problems;

    If there are no problems with that, write and send /start to restart the bot.

  • No channels are available for selection:

    1. Check the internet connection;
    2. Check the Telegram problems;
    3. Check that the bot is an admin of the channel and is allowed to read messages.

🤝 Help DigestTelegramBot to become better: Follow the Link. Name and describe the problem you faced, attach the screenshots and/or screen recordings.

💡 Have interesting ideas? Follow the Link. In the Title section, write "New Feature: " and its name. Dindescribe your vision, add links and/or attach references.

License

Distributed under the MIT License. See LICENSE for more information.

Back to Top

Contact

Ivan Ershov - tg: @spiritonchic - i.ershov@innopolis.university

Project Link: https://github.com/mituttta051/Digest-Telegram-Bot

Back to Top

Acknowledgments

Here are several credits by Team 49.

Back to Top

About

License:MIT License


Languages

Language:Python 99.7%Language:Dockerfile 0.3%