{"id":31404419,"url":"https://github.com/artemka-sh/samotlor-quest-tgbot","last_synced_at":"2026-05-08T07:32:10.016Z","repository":{"id":316873416,"uuid":"1008381983","full_name":"artemka-sh/samotlor-quest-tgbot","owner":"artemka-sh","description":"Telegram quiz + quest, survey, bot written in modern C++17 (Qt + TgBot) with PostgreSQL persistence.","archived":false,"fork":false,"pushed_at":"2025-09-27T07:56:34.000Z","size":21325,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"master","last_synced_at":"2025-09-27T09:34:46.962Z","etag":null,"topics":["cmake","cpp","cpp17","database","easy-deployment","postgresql","qt6","quest","quiz","quiz-app","survey","telegram","telegrambot","tgbot"],"latest_commit_sha":null,"homepage":"https://t.me/samotlor_quest_bot","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/artemka-sh.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-06-25T13:06:45.000Z","updated_at":"2025-09-27T08:06:49.000Z","dependencies_parsed_at":"2025-09-27T09:34:48.934Z","dependency_job_id":null,"html_url":"https://github.com/artemka-sh/samotlor-quest-tgbot","commit_stats":null,"previous_names":["artemka-sh/samotlor-quest-tgbot"],"tags_count":null,"template":false,"template_full_name":null,"purl":"pkg:github/artemka-sh/samotlor-quest-tgbot","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/artemka-sh%2Fsamotlor-quest-tgbot","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/artemka-sh%2Fsamotlor-quest-tgbot/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/artemka-sh%2Fsamotlor-quest-tgbot/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/artemka-sh%2Fsamotlor-quest-tgbot/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/artemka-sh","download_url":"https://codeload.github.com/artemka-sh/samotlor-quest-tgbot/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/artemka-sh%2Fsamotlor-quest-tgbot/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32770995,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-08T02:36:36.067Z","status":"ssl_error","status_checked_at":"2026-05-08T02:36:07.210Z","response_time":54,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":["cmake","cpp","cpp17","database","easy-deployment","postgresql","qt6","quest","quiz","quiz-app","survey","telegram","telegrambot","tgbot"],"created_at":"2025-09-29T16:47:32.680Z","updated_at":"2026-05-08T07:32:09.985Z","avatar_url":"https://github.com/artemka-sh.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"# QuizQuest Bot\n\n\u003e A Telegram quest/quiz bot built entirely in modern **C++17** with **Qt** \u0026 **TgBot**)\n\n![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)\n![C++17](https://img.shields.io/badge/C%2B%2B-17-blue)\n\n---\n\n## ✨ Features\n\n| Category        | Details                                                                                                      |\n| --------------- | ------------------------------------------------------------------------------------------------------------ |\n| Gameplay        | Interactive question‑by‑question quest (supports MCQ \u0026 free‑form answers), instant validation, final summary |\n| Persistence     | PostgreSQL storage of users \u0026 answers, auto‑migration on first launch                                        |\n| Config‑driven   | All wording/questions in a single **`questions.json`**; secrets in **`config.json`**                         |\n| Keyboard UX     | Reply keyboard with answer options, hides automatically after click                                          |\n| Fault tolerance | Long‑poll restart loop, graceful handling of unknown updates, reconnect back‑off                             |\n| i18n‑ready      | UTF‑8 everywhere; questions file can be any language                                                         |\n\n---\n\n## 🤔 Why another Telegram bot in C++?\n\n* **Performance \u0026 footprint** – native binary starts in \\~10 ms and uses \u003c20 MB RAM even on a 512 MB VPS.\n* **One dependency graph** – same tool‑chain we already use for the rest of the backend (C++, CMake, clang‑tidy).\n* **Fun \u0026 curiosity** – pushing C++ outside the usual server/embedded bubble.\n\nIf you just need a simple bot, Python is fine. This repo is for people who enjoy unusual tech choices.\n\n---\n\n## 🏗️ Tech stack\n\n* **C++17** – core language, RAII design\n* **Qt 5/6** (Core \u0026 SQL) – JSON parsing, PostgreSQL driver, cross‑platform utils\n* **[TgBot](https://github.com/reo7sp/tgbot-cpp)** – Telegram Bot API for C++\n* **PostgreSQL ≥ 14(tested)** – persistent storage \n* **CMake ≥ 3.20** – build system\n\n\n---\n\n## 📂 Project layout\n\n```\n├── CMakeLists.txt\n├── src/\n│   ├── botapplication.hpp / .cpp   # high‑level orchestrator\n│   ├── telegram_messenger.*        # thin wrapper around TgBot::Bot\n│   ├── database_manager.*          # Qt SQL helpers\n│   ├── questions.*                 # loads questions.json\n│   └── config.*                    # config data parser\n├── res/\n│   ├── config.json                 # secrets \u0026 DB creds \n│   └── questions.json              # game script\n└── tests/\n```\n\n---\n\n## 🚀 Quick start\n\n### 1 · Clone \u0026 build\n\n```bash\ngit clone https://github.com/artemka-sh/samotlor-quest-tgbot/ #you must recursive udate git submodules\ncd samotlor-quest-tgbot\ncmake ..\ncmake --build .\n```\n\n### 2 · Create `res/config.json`\n\n```json\n{\n  \"telegram_token\": \"123456:ABC‑DEF…\",\n  \"db_address\": \"localhost\",\n  \"db_port\": \"5432\",\n  \"db_name\": \"questbot\",\n  \"db_user\": \"questbot\",\n  \"db_password\": \"secret\",\n  \"lazy_time\": 3600            #don't using\n}\n```\n\n### 3 · Run migrations (auto)\n\nFirst launch will create tables `users` and `user_answers` if they don’t exist.\n\n### 4 · Start the bot\n\n```bash\n./build/samotlor-quest-tgbot       # logs to stdout\n```\n\n## background working with log to file\n```bash\n nohup ./samotlor-quest-tgbot \u003elog4.txt 2\u003e\u00261 \u0026\n```\n\n\u003e The binary restarts itself with a built‑in endless loop that catches any exception and starts over.\n\n\n\n## 🧩 Extending the quest\n\n1. Open **`res/questions.json`**.\n2. Append a new object: `{ \"id\": 42, \"type\": \"text\", \"question\": \"What is the answer?\", \"allowCustomAnswer\": true }`\n3. Restart the bot – no recompilation required.\n\nDetails on the schema are in `questions.hpp` comments.\n\n---\n\n## 🙌 Contributing\n\nPRs and issues are welcome!\n---\n\n## 📜 License\n\nDistributed under the MIT License. See `LICENSE` for details.\n\n## How it's look like\n![exampleimage](https://raw.githubusercontent.com/artemka-sh/files/refs/heads/main/exampletgbotq.jpg)\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fartemka-sh%2Fsamotlor-quest-tgbot","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fartemka-sh%2Fsamotlor-quest-tgbot","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fartemka-sh%2Fsamotlor-quest-tgbot/lists"}