Skip to content

VasuLabs/gramic

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

gramic

Telegram webhook in Rust.

[dependencies]
gramic = "0.1"
tokio  = { version = "1", features = ["full"] }

Usage

// receive updates
gramic::serve("TOKEN", "https://yourserver.com", |u| async move {
    println!("{:?}", u.message);
}).await.unwrap();

// set webhook
gramic::set("TOKEN", "https://yourserver.com").await?;

// delete webhook
gramic::delete("TOKEN").await?;

// check status
let info = gramic::info("TOKEN").await?;

Custom config

Bot::new("TOKEN", "https://yourserver.com")
    .port(8443)
    .path("/updates")
    .secret("some_secret")
    .serve(|u| async move { println!("{:?}", u.message); })
    .await?;

Run the example

cp .env.example .env

cargo run --example bot -- serve
cargo run --example bot -- set
cargo run --example bot -- delete
cargo run --example bot -- info

About

Telegram webhook in Rust: set, delete, and receive updates in a few lines.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages