{"id":13679058,"url":"https://github.com/dimaplel/telegram-suggestions-bot","last_synced_at":"2025-04-29T16:30:53.086Z","repository":{"id":49782349,"uuid":"518039289","full_name":"dimaplel/telegram-suggestions-bot","owner":"dimaplel","description":"Make your own Telegram bot for processing all incoming suggestions/requests/offers. Useful for client support or social organisations.","archived":false,"fork":false,"pushed_at":"2024-02-09T14:25:47.000Z","size":39,"stargazers_count":18,"open_issues_count":0,"forks_count":9,"subscribers_count":1,"default_branch":"main","last_synced_at":"2024-11-11T21:38:11.776Z","etag":null,"topics":["aiogram","python-telegram-bot","suggestions-bot","support-bot","telegram-bot"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/dimaplel.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-07-26T11:48:18.000Z","updated_at":"2024-08-09T12:57:26.000Z","dependencies_parsed_at":"2022-08-02T20:00:30.166Z","dependency_job_id":"e699a0b6-6adb-4795-bd0f-8a1b1a389e0b","html_url":"https://github.com/dimaplel/telegram-suggestions-bot","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dimaplel%2Ftelegram-suggestions-bot","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dimaplel%2Ftelegram-suggestions-bot/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dimaplel%2Ftelegram-suggestions-bot/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dimaplel%2Ftelegram-suggestions-bot/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dimaplel","download_url":"https://codeload.github.com/dimaplel/telegram-suggestions-bot/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251540066,"owners_count":21605838,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["aiogram","python-telegram-bot","suggestions-bot","support-bot","telegram-bot"],"created_at":"2024-08-02T13:01:01.456Z","updated_at":"2025-04-29T16:30:48.061Z","avatar_url":"https://github.com/dimaplel.png","language":"Python","funding_links":[],"categories":["Python"],"sub_categories":[],"readme":"# Suggestions Bot - Telegram 🇬🇧\n\n[_Версія українською 🇺🇦_](https://github.com/dimaplel/telegram-suggestions-bot#suggestions-bot---telegram--1)\n\nBot was created originally for IASA Student Council to handle suggestions, questions and requests. However, you can \nfreely fork this repository and create your own bot.\n\n## How bot works\n\n1. User sends a message to the bot\n2. Bot forwards the message to the chat\n3. Chat participant replies to the forwarded message\n4. Bot copies the answer and sends it to user\n\n## Features\n\n- __Text, Photos, Videos, Documents, GIFs, Voice Messages__ and __Geolocation__ are supported\n- Customisable messages for bot to answer\n- Ban/unban users using reply\n- Messages editing. Changes would be displayed in private/group chat\n\n\u003e ❗ __Note: changing pictures/videos is not possible, only their captions__\n\n### Banning/unbanning\n\nTo ban spamming/unfriendly users, you should reply on forwarded from user message like this: `/ban` or like this: `/ban \u003creason\u003e`, \nwhere the reason will be displayed to user if he would try to send something again. Then, bot will reply to you whether \nit was successful or not.\n\nIn contrast, to unban users, you should reply on user's message with `/unban` and bot will notify on command success \nor failure.\n\n### Message editing\n\nMessage editing is implemented using SQL table. When a message is being sent - bot inserts original message id and\nforwarded message id into SQL table. For storage optimisation purposes in the table a script was written, which deletes \nrow after some time passes, which can be found in [`create_bot.py`](https://github.com/dimaplel/telegram-suggestions-bot/blob/main/create_bot.py) \nTo configure time interval after which added entry is to be deleted (1 day by default), edit `.env` variable \n`ROW_REMOVAL_INTERVAL` according to time standards in SQL.\n\n## Config and environment\n\nTo setup a bot for your own usage, you should specify those variables in \n[`.env`](https://github.com/dimaplel/telegram-suggestions-bot/blob/main/.env).\n\n``` bash\nCOMPOSE_FILE=docker-compose.yml\n\n# Bot Data\nTELEGRAM_TOKEN=\"\u003cYOUR BOT TOKEN\u003e\" # your bot's token\nCHAT_ID=0 # chat id where the bot will forward users' messages\n\n# Database Data\nPOSTGRES_HOST=\"\u003cYOUR HOST\u003e\" # host of sql database\nPOSTGRES_PASSWORD=\"\u003cYOUR PASSWORD\u003e\" # password to access database\nPOSTGRES_DB=\"\u003cYOUR DATABASE NAME\u003e\" # database name\nPOSTGRES_USER=\"\u003cUSER\u003e\" # username to log in \nPOSTGRES_PORT=5432 # port to connect to database\nPGDATA=/var/lib/postgresql/data\nROW_REMOVAL_INTERVAL=\"1 days\" # interval after which an entry is removed from the message table\n```\n\nTo change default text to your custom, redefine values of the dictionary for each phrase in \n[`config.py`](https://github.com/dimaplel/telegram-suggestions-bot/blob/main/config.py).\n\n``` bash\n# Predefined text to send\nTEXT_MESSAGES = {\n    'start': 'Welcome to Suggestions Bot 👋 \\n\\n Please, send your message and we will process your request.',\n    'message_template': '\u003ci\u003eMessage from: \u003cb\u003e@{0}\u003c/b\u003e.\u003c/i\u003e\\n\\n{1}\u003cb\u003eid: {2}\u003c/b\u003e',\n    'is_banned': '❌ User is banned!', 'has_banned': '✅ User has been successfully banned!',\n    'already_banned': '❌ User is already banned!', 'has_unbanned': '✅ User has been successfully un-banned!',\n    'not_banned': '❌ There is no such user in the ban list!',\n    'user_banned': '🚫 You cannot send messages to this bot!',\n    'user_unbanned': '🥳 You have proven your innocence, and now you can write to this bot again!',\n    'user_reason_banned': '🚫 You cannot send messages to this bot due to the reason: \u003ci\u003e{}\u003c/i\u003e.',\n    'pending': 'Thank you for your request! We are already into processing it.',\n    'unsupported_format': '❌ Format of your message is not supported and it will not be forwarded.',\n    'message_not_found': '❌ It looks like your message was sent more that a day ago. Message to edit was not found!',\n    'message_was_not_edited': '❌ Unfortunately you cannot edit images/videos themselves.'\n                              'Please, send a new message.',\n    'reply_error': '❌ Please, reply with /ban or /unban only on forwarded from user messages!'\n}\n```\n\n## Installation guide\n\n1. Clone this repository using terminal or tools in your IDE: \n`git clone https://github.com/dimaplel/telegram-suggestions-bot.git`\n2. Change directory in terminal `cd $repository-direcory`\n3. Download requirements `pip install -r requirements.txt`\n4. Edit and update [`.env`](https://github.com/dimaplel/telegram-suggestions-bot/blob/main/.env) and/or \n[`config.py`](https://github.com/dimaplel/telegram-suggestions-bot/blob/main/config.py)\n5. Launch Docker\n6. Run the bot with `docker compose up --build` or with [GNU Make](https://www.gnu.org/software/make/):\n`make up`\n\n## Authors\n\n* [Dmytro Ivanenko](https://github.com/dimaplel)\n* [Nikita Ryabin](https://github.com/akaspeh)\n\n***\n# Suggestions Bot - Telegram 🇺🇦\n\nПочатково, бот був створений для СтудРади ІПСА для обробки пропозицій, питань та запитів. Однак ви легко можете форкати \nданий репозиторій і кастомізувати його під свої потреби.\n\n## Як працює бот\n\n1. Користувач надсилає повідомлення боту\n2. Бот пересилає повідомлення в чат\n3. Учасник чату відповідає на переслане повідомлення\n4. Бот копіює відповідь і надсилає її користувачеві\n\n## Особливості\n\n- Підтримуються __Текст, Зображення, Відео, Документи, Гіфки, Голосові Повідомлення__ та __Геолокація__\n- Кастомізація стандартних відповідей бота на трігери або команди\n- Бан/розбан користувачів за допомогою відповіді на повідомлення\n- Редагування повідомлень. Зміни відображатимуться в приватному/груповому чаті\n\n\u003e ❗ __Примітка: змінити зображення/відео неможливо, лише підпис__\n\n### Бан/розбан\n\nДля того, щоб забанити користувачів, що спамлять або поводять себе непривітно, ви маєте відповісти на повідомлення \nкористувача так: `/ban` або так: `/ban \u003cпричина\u003e`, де причина відобразиться, якщо цей користувач знову спробує щось \nнадіслати. Потім, бот відповість статусом виконання операції.\n\nНа противагу, щоб розбанити користувача, потрібно відповісти на повідомлення користувача `/unban`, і бот відповість, що \nкоманда виконалась успішно чи невдало.\n\n### Редагування повідомлень\n\nРедагування повідомлень реалізовано за допомогою SQL таблиці. Коли присилається повідомлення - бот вставляє\nв таблицю id оригінального повідомлення та id пересланого повідомлення. Задля оптимізації місця у таблиці було \nнаписано тригер, який видаляє рядок через деякий час (перевірка на час здійснюється, коли новий елемент додається\nдо таблиці). Тригер встановлюється у [`create_bot.py`](https://github.com/dimaplel/telegram-suggestions-bot/blob/main/create_bot.py). \nДля зміни часу до видалення запису (1 день за замовчуванням) налаштуйте змінну оточення `ROW_REMOVAL_INTERVAL` згідно\nз форматом часу SQL.\n\n## Config та змінні оточення\n\nДля того, щоб налаштувати бота для власного використання, потрібно вказати наступні змінні в \n[`.env`](https://github.com/dimaplel/telegram-suggestions-bot/blob/main/.env)\n\n``` bash\nCOMPOSE_FILE=docker-compose.yml\n\n# Bot Data\nTELEGRAM_TOKEN=\"\u003cYOUR BOT TOKEN\u003e\" # токен вашого бота\nCHAT_ID=0 # id чату, куди бот пересилатиме повідомлення від користувачів\n\n# Database Data\nPOSTGRES_HOST=\"\u003cYOUR HOST\u003e\" # хост бази даних sql\nPOSTGRES_PASSWORD=\"\u003cYOUR PASSWORD\u003e\" # пароль для бази даних\nPOSTGRES_DB=\"\u003cYOUR DATABASE NAME\u003e\" # ім'я бази данних\nPOSTGRES_USER=\"\u003cUSER\u003e\" # username для входу в базу даних\nPOSTGRES_PORT=5432 # порт для з'єднання з базою даних\nPGDATA=/var/lib/postgresql/data\nROW_REMOVAL_INTERVAL=\"1 days\" # інтервал після якого запис про повідомлення видаляється з таблиці\n```\n\nДля того, щоб змінити стандартний текст відповідей бота на ваш власний, змініть значення в словнику для кожної фрази в \n[`config.py`](https://github.com/dimaplel/telegram-suggestions-bot/blob/main/config.py)\n\n``` bash\n# Predefined text to send\nTEXT_MESSAGES = {\n    'start': 'Ласкаво просимо 👋\\n\\nНапишіть своє запитання / пропозицію, і ми відповімо Вам найближчим часом.',\n    'message_template': '\u003ci\u003eПовідомлення від: \u003cb\u003e@{0}\u003c/b\u003e.\u003c/i\u003e\\n\\n{1}\u003cb\u003eid: {2}\u003c/b\u003e',\n    'is_banned': '❌ Користувач забанений!', 'has_banned': '✅ Користувач був успішно забанений!',\n    'already_banned': '❌ Користувач уже забанений!', 'has_unbanned': '✅ Користувач був успішно розбанений!',\n    'not_banned': '❌ Такого користувача немає в бан-лісті!',\n    'user_banned': '🚫 Ви більше не можете писати в бот пропозицій!',\n    'user_reason_banned': '🚫 Ви більше не можете писати в бот пропозицій через причину: \u003ci\u003e{}\u003c/i\u003e.',\n    'user_unbanned': '🥳 Сама благодать зійшла з небес, і тепер ви знову можете писати до боту пропозицій!',\n    'pending': 'Дякуємо за ваше звернення. Ми вже оброблюємо Ваш запит!',\n    'unsupported_format': '❌ Формат вашого повідомлення не підтримується, воно не буде переслане.',\n    'message_not_found': '❌ Схоже, що ви відправляли повідомлення більше трьох діб тому, повідомлення не було знайдено!'\n    , 'message_was_not_edited': '❌ На жаль не можна редагувати зображення в повідомленнях. '\n                                'Будь ласка, надішліть нове зображення',\n    'reply_error': '❌ Будь-ласка, давайте відповідь /ban або /unban лише на переслані від користувачів повідомлення!'\n}\n```\n\n## Керівництво по встановленню\n\n1. Зклонуйте репозиторій за допомогою терміналу або інструментів у вашій IDE: `git clone https://github.com/dimaplel/telegram-suggestions-bot.git`\n2. Змініть папку в терміналі `cd $repository-directory`\n3. Встановіть вимоги `pip install -r requirements.txt`\n4. Відредагуйте та оновіть [`.env`](https://github.com/dimaplel/telegram-suggestions-bot/blob/main/.env) та/або\n[`config.py`](https://github.com/dimaplel/telegram-suggestions-bot/blob/main/config.py)\n5. Запустіть Docker\n6. Запустіть бота у терміналі `docker compose up --build` або з [GNU Make](https://www.gnu.org/software/make/):\n`make up`\n\n## Автори\n\n* [Дмитро Іваненко](https://github.com/dimaplel)\n* [Нікіта Рябін](https://github.com/akaspeh)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdimaplel%2Ftelegram-suggestions-bot","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdimaplel%2Ftelegram-suggestions-bot","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdimaplel%2Ftelegram-suggestions-bot/lists"}