Skip to content

top-tl/java-telegram-bot

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

toptl-java-telegram-bot

TelegramBots (Java) plugin for TOP.TL — automatically post bot stats and check user votes.

Installation

Maven

<dependency>
    <groupId>tl.top</groupId>
    <artifactId>toptl-java-telegram-bot</artifactId>
    <version>1.0.0</version>
</dependency>

Usage

import tl.top.toptl.TopTLClient;
import tl.top.toptl.telegram.TopTLExtension;

public class MyBot extends TelegramLongPollingBot {
    private final TopTLExtension toptl;

    public MyBot() {
        TopTLClient client = new TopTLClient("your-toptl-token");
        toptl = new TopTLExtension(client, "my_bot");
    }

    @Override
    public void onUpdateReceived(Update update) {
        toptl.handleUpdate(update);

        // Check if user voted
        if (update.hasMessage()) {
            boolean voted = toptl.hasVoted(update.getMessage().getFrom().getId());
        }
    }

    // Don't forget to call toptl.shutdown() when your bot stops
}

License

MIT

About

TelegramBots (Java) plugin for TOP.TL — auto-post bot stats & check votes

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages