Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/blockkwork/zgram

the best (as of 2024) zig framework for creating telegram bots
https://github.com/blockkwork/zgram

Last synced: about 2 months ago
JSON representation

the best (as of 2024) zig framework for creating telegram bots

Awesome Lists containing this project

README

        

# zgram

## 💡 Info
In development. use at your own risk

## 🚀 Example
full example: [src/main.zig](https://github.com/blockkwork/zgram/blob/main/src/main.zig)

```zig
var gpa = std.heap.GeneralPurposeAllocator(.{}){};
const allocator = gpa.allocator();

var tg = try Client.init(allocator, TOKEN, .{});
{
try tg.handleAll(handleKeyboard); // handle all messages
try tg.command("start", handleAll); // handle /start command
try tg.hears("hello from zgram!", handleAll); // handle message
try tg.action("data1", handleQuery); // handle callback query
}
try tg.startPolling(.{ .drop_pending_updates = true });
```

![image](https://github.com/user-attachments/assets/fa302fab-4230-4298-883d-e2f8c77454ce)