Skip to content

Instantiation

pharastar.dev edited this page Nov 24, 2022 · 1 revision

Instantiate Default TelegramBot

import tech.digitaldojo.jtba.TelegramBot;

public class MyProject {

    private static TelegramBot bot;

    public static void main(String[] args) {
        if (args.length < 1) throw new IllegalArgumentException("Token cannot be null please insert it as first program argument.");
        String token = args[0];
        // creates a bot with polling active ( fetching updates all 300ms ) 
        bot = new TelegramBot(token);
    }

}

Clone this wiki locally