Support with Telegram Api - java

556 Views Asked by At

Im trying to build a telegram bot, I've started

with this link https://github.com/rubenlagus/TelegramBots

added maven dependency

<dependency>
    <groupId>org.telegram</groupId>
    <artifactId>telegrambots</artifactId>
    <version>6.0.1</version>
</dependency>

created a main class

 // Example taken from https://github.com/rubenlagus/TelegramBotsExample
    public class Main {
        public static void main(String[] args) {
            try {
                TelegramBotsApi telegramBotsApi = new TelegramBotsApi(DefaultBotSession.class);
                telegramBotsApi.registerBot(new ChannelHandlers());
                telegramBotsApi.registerBot(new DirectionsHandlers());
                telegramBotsApi.registerBot(new RaeHandlers());
                telegramBotsApi.registerBot(new WeatherHandlers());
                telegramBotsApi.registerBot(new TransifexHandlers());
                telegramBotsApi.registerBot(new FilesHandlers());
            } catch (TelegramApiException e) {
                e.printStackTrace();
            }
        }
    }

but all the new classes are not familiar and not available for auto import

enter image description here

can anyone tell me which missing dependency I have ?

1

There are 1 best solutions below

1
On

When you add a maven dependency, you must update your project.

For this, right click on your project folder in e. G. package explorer, and hover on the entry "Maven". Now there should be a menu item like "Update project".

And now the libraries should be available.

Personal tip: I update the maven project everytime when I changed something in pom.xml.