Skip to content

Modular Telegram bot that will simplify the studying routine

Notifications You must be signed in to change notification settings

tortamque/group-helper-bot

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🇺🇦

Груповий бот-помічник

Це Telegram бот, який допоможе автоматизувати навчальну рутину

Повністю настроюваний, модульний, простий в обслуговуванні, простий у масштабуванні 🐸

Необхідні пакети

Пакет Посилання
APScheduler https://pypi.org/project/APScheduler/
Requests https://pypi.org/project/requests/
Pyrogram https://pypi.org/project/Pyrogram/
TgCrypto https://pypi.org/project/TgCrypto/

Можливості

  • Формування та управління чергою
  • Відправка розкладу (Розклад береться із сайту schedule.kpi.ua)
  • Нагадування про початок пари (За наявності, відправляється посилання на пару)
  • Управління локальною базою даних із інтерфейсу бота

Авторизація та встановлення

1. Авторизація

  1. Для початку тобі потрібно створити власного бота. Для цього напиши офіційному боту (https://t.me/BotFather), за допомогою команди /newbot і наявних інструкцій ти створиш власного.
  2. Запиши унікальний токен (Має вигляд 1234567:AAABBBCCCDDDEEEFFF)
  3. Створи унікальний .session файл твого бота (Детальніше)

2. Встановлення

  1. Тепер потрібно налаштувати основні параметри бота. Для цього, в папці config/app.py зміни ім'я сесії на своє.
  2. В папці config/config.py зміни усі параметри
    Примітка:
    admin_user_id - ID користувача з підвищеними правами (Зможе видаляти чергу, навіть якщо він її не створив, управляти базою даних і т.п.)
    chat_id - ID чату, в якому буде працювати бот
    bot_username - Username бота (без символу @)
    group_name - Назва групи (Наприклад: XX-11)
  3. Завантаж усі файли собі на сервер
  4. Встанови необхідні пакети
  5. Запусти бота: python3 main.py

Модулі

  1. Queue - Формування черги
  2. Reminder - Нагадування про початок пари
  3. Database - Управління базою даних
  4. Timetable - Відправка розкладу
  5. Tools - Інструменти

Команди

Черги

  1. /create <назва черги> - створити чергу
  2. /delete <назва черги> - видалити чергу
  3. /join <назва черги> - записатись у чергу
  4. /leave <назва черги> - вийти з черги
  5. /check - перевірити наявні черги
  6. /pass <кількість людей> <назва черги> - пропустити людей в черзі
  7. /reset

Розклад

  1. /week - Розклад на цей тиждень
  2. /nextweek - Розклад на наступний тиждень
  3. /today - Розклад на сьогодні
  4. /tomorrow - Розклад на завтра

Управління базою даних

  1. /setup_db - Налаштувати базу даних
  2. /reset_db - Очистити базу даних
  3. /show_db - Показати вміст бази даних
  4. /editlink <ID пари> <нове посилання> - Змінити посилання на пару
  5. /ids - Отримати ID всіх пар

Інструменти

  1. /ping - Пінг
  2. /chat_id - Отримати ID чату
  3. /user_id - Показати ID користувача, який відправив цю команду
  4. /user_id у відповідь на повідомлення- Показати ID користувача, на якого відповіли

🇺🇸

Group Helper Bot

This is the Telegram bot that will simplify the studying routine

Fully customizable, Modular, Easy-to-maintain, Easy-to-scale 🐸

Required packages

Package Link
APScheduler https://pypi.org/project/APScheduler/
Requests https://pypi.org/project/requests/
Pyrogram https://pypi.org/project/Pyrogram/
TgCrypto https://pypi.org/project/TgCrypto/

Сapabilities

  • Queue formation and management
  • Sending the schedule (The schedule is taken from the website schedule.kpi.ua)
  • Reminder about the start of the lesson (If available, a link to the lesson is sent)
  • Local database management from the bot interface

Authorization and Setup

1. Authorization

  1. Firstly you need to create your own bot. To do this, write to the official bot (https://t.me/BotFather), using the command /newbot and the available instructions, you will create your own.
  2. Write down the unique token (It looks like 1234567:AAABBBCCCDDDEEEFFF)
  3. Create a unique .session file of your bot (Details)

2. Setup

  1. Now you need to configure the basic parameters of the bot. To do this, change the session name to your own in the config/app.py folder.
  2. Change all parameters in the config/config.py folder
    Note:
    admin_user_id - ID of a user with elevated rights (Can delete a queue even if he did not create it, manage the database, etc.)
    chat_id - ID of the chat in which the bot will work
    bot_username - Username of the bot (without the @ symbol)
    group_name - Group name (For example: XX-11)
  3. Upload all files to your server
  4. Install required packages
  5. Run the bot: python3 main.py

Modules

  1. Queue - Queue formation
  2. Reminder - Reminder about the start of the lesson
  3. Database - Database management
  4. Timetable - Sending the schedule
  5. Tools - Tools

Commands

Queue

  1. /create <queue name> - create a queue
  2. /delete <queue name> - delete the queue
  3. /join <queue name> - join the queue
  4. /leave <queue name> - leave the queue
  5. /check - check available queues
  6. /pass <number of people> <queue name> - skip people in the queue
  7. /reset

Schedule

  1. /week - Schedule for this week
  2. /nextweek - Schedule for the next week
  3. /today - Schedule for today
  4. /tomorrow - Schedule for tomorrow

Database Management

  1. /setup_db - Set up the database
  2. /reset_db - Clear the database
  3. /show_db - Show the content of the database
  4. /editlink <lesson ID> <new link> - Change the lesson link
  5. /ids - Get IDs of all lessons

Tools

  1. /ping - Ping
  2. /chat_id - Get chat ID
  3. /user_id - Show the ID of the user who sent this command
  4. /user_id in response to the message - Show the ID of the user who was answered