Skip to main content

Crate toptl_teloxide

Crate toptl_teloxide 

Source
Expand description

Teloxide plugin for TOP.TL — autopost stats, gate handlers behind votes, handle vote webhooks.

§Quick start

use std::time::Duration;
use toptl::TopTL;
use toptl_teloxide::TopTLPlugin;

#[tokio::main]
async fn main() {
    let client = TopTL::new("toptl_xxx");
    let plugin = TopTLPlugin::new(client, "mybot");
    plugin.start(Duration::from_secs(30 * 60));

    // Call plugin.record(...) from your handlers, or use
    // record_update(&plugin, &msg).await when the "teloxide"
    // feature is enabled.
}

Structs§

StatsPayload
Payload for post_stats. All fields are optional — the server only updates the ones you send, so you can push a member-count-only update without zeroing out group/channel counts.
TopTL
Async client for the TOP.TL public API.
TopTLPlugin
Tracks unique users / groups / channels and autoposts counts to TOP.TL.

Enums§

ChatKind
Chat kind for TopTLPlugin::record.

Functions§

record_update
Helper that records every teloxide Message into the plugin.