Skip to content

Royna2544/c_cpp_telegrambot

Repository files navigation

A Telegram bot, mostly used by my own uses and learning purposes

Status

Build Glider (Multi Platform)

Build Glider builder-rs

CodeQL Analysis

Used languages

C C++ Kotlin Javascript SQLite3 HTML5 CSS SCSS PHP
C C++ Kotlin Javascript SQLite HTML5 CSS SCSS PHP
popen_wdt lib main C++ code Android socket client app Webpage Database support Webpage Webpage Webpage Webpage

Used external libraries

  • Abseil C++ common library - Used for logging - Link
  • C++ HTTP library (cpp-httplib) - Used for website server support - Link
  • CppTrace - C++ Backtrace Library - Link
  • cryptopp - Used for hashing and encryption - Link
  • CURL - Used for HTTP requests - Link
  • dlfcn Win32 support - Used for runtime loader for commands (Windows only) - Link
  • fmt - Format library (header-only mode) - Link
  • Fruit - C++ Dependency Injection Framework - Link
  • gRPC - C++ gRPC implementation for remote services - Link
  • GTest - Test framework for C++ codes - Link
  • libxml2 - Used for XML parsing in StringResLoader - Link
  • llama.cpp - Used for local LLM support - Link
  • Lua - Lua language integration (for command modules) - Link
  • nlohmann_json - Used for JSON parsing and serialization - Link
  • OpenCV - Used for image/video processing - Link
  • Protobuf - Used for alternative database backend and gRPC - Link
  • Sol2 - C++ and Lua integration - Link
  • SQLite3 - Used for one database backend, for whitelist/blacklist saving support
  • stduuid - Used for generating UUIDs - Link
  • TgBot-cpp - Core library for being a Telegram bot - Link

Image Processing Libraries

  • libpng - PNG image format support
  • libjpeg-turbo - JPEG image format support
  • libwebp - WebP image format support

Build Tools & Integration

  • Corrosion - Rust and CMake integration - Link
  • Git - Used for build information generation (commit ID, message, origin)
  • Rust - Used for some command modules and the builder-rs gRPC server - Link

Goals

  • There is no goal - I will just add stuff whichever I could and learn those while writing code for it

TODOs

  • See TODO file, though its not really updated

Cmake options

CMake options has a common prefix of 'TGBOTCPP_'

  • TGBOTCPP_BUILD_TESTS: Build the test suite (default: OFF)
  • TGBOTCPP_RUST_MODULES: Enable and build command modules written with Rust language (default: OFF)
  • TGBOTCPP_LUA_MODULES: Enable support for command module written with Lua language (default: ON)
  • TGBOTCPP_ENABLE_LOCAL_LLM: Enable support for local LLM framework (Requires compatible hardware, e.g. NVIDIA GPU) (default: OFF)
  • TGBOTCPP_CROSS_COMPILING: Whether we are cross-compiling, can be auto detected or be manually set
  • TGBOTCPP_AUTODETECT_CROSS_COMPILING: Auto detect TGBOTCPP_CROSS_COMPILING via CMAKE_HOST_CMAKE_SYSTEM_PROCESSOR and CMAKE_SYSTEM_PROCESSOR
  • TGBOTCPP_CROSS_COMPILE_INSTALL_PATH: Path that the package is installed to (i.e. CMAKE_INSTALL_PREFIX). Default: /usr/bin (assuming debian systems)
  • TGBOTCPP_CROSS_COMPILE_CC: C Compiler that is present on remote system, can be omitted - then the following backend is disabled.
  • TGBOTCPP_CROSS_COMPILE_CXX: C++ Compiler that is present on remote system, can be omitted - then the following backend is disabled.
  • TGBOTCPP_CROSS_COMPILE_PYTHON: Python interpreter that is present on remote system, can be omitted - then the following backend is disabled.

Config file options

Section Main

  • Token: Telegram bot token
  • LogFile: Log file path
  • GitHubToken: GitHub token (Used for private repo access)
  • OptionalComponents: Enable optional components. Comma-separated list of components to enable. Supported components: "webserver", "datacollector"
  • BuildBuddyApiKey: BuildBuddy API key for Android RBE

Section Database

  • FilePath: Database file path
  • Type: Database type (sqlite or protobuf)

Section LLM

  • BackendType: LLM backend type (local, localnet)
  • ModelLocation: LLM location (file path or network address)
  • AuthKey: LLM authentication key (if required)

Section Network

  • PrimarySocketUrl: Primary socket URL that is binded to. e.g. 192.168.0.X:239 or unix://path/to/file
  • SecondarySocketUrl: Secondary socket URL
  • LoggingSocketUrl: Logging socket URL
  • ApiServer: Custom Telegram API server URL
  • ApiServerFilePathRemovePrefix: Prefix to remove from Telegram #getFile file paths when using a custom API server
  • ApiServerFilePathAppendPrefix: Prefix to append to Telegram #getFile file paths when using a custom API server
  • BuilderRSServer: Builder-RS gRPC server address

About

Project Glider. Can you believe there is a C++ written bot? Here it is.

Resources

License

Stars

Watchers

Forks

Contributors