Skip to content

AshokShau/gotdbot

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

32 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

gotdbot

GitHub go.mod Go version Go Reference License

gotdbot is a powerful, pure Go wrapper for TDLib (Telegram Database Library). It provides a simple and idiomatic way to build Telegram clients and bots using Go.

Current Version: v0.5.0 and TDLib v1.8.61.


Features

  • Pure Go: No CGO mess in your application code (uses purego to load libtdjson).
  • High Performance: Direct binding to TDLib's JSON interface.
  • Dispatcher System: Built-in update dispatcher with middleware-style handlers.
  • Filters: Powerful and composable filters for message matching.
  • Type-Safe: Fully generated Go structs for all TDLib types and methods.
  • Context Aware: Easy access to effective messages, chats, and users.

Requirements

  • Go: version 1.22 or newer

  • TDLib: the compiled libtdjson shared library

    • Follow the official TDLib build instructions

    • Make sure the library is accessible on your system:

      • libtdjson.so (Linux)
      • libtdjson.dylib (macOS)
      • tdjson.dll (Windows)
    • Alternative: run

      go run github.com/AshokShau/gotdbot/scripts/tools@latest

      to automatically download the latest precompiled TDLib binaries.


Installation

go get github.com/AshokShau/gotdbot

Examples

Sample bots can be found in the examples directory.

  • Echo Bot: A simple bot that echoes text messages.
  • User Bot: Example of running a user account automation.

Contributing

Contributions are welcome! Please open issues for bugs or feature requests.


License

This project is licensed under the MIT License.


Inspired by