M
M
Mimocodil2021-04-04 19:06:49
Java
Mimocodil, 2021-04-04 19:06:49

Why doesn't maven find ApiContextInitializer from Telegram bots api?

Following the instructions on the net, I created an idea project with maven support and added the dependency to pom.xml

<dependencies>
    <dependency>
        <groupId>org.telegram</groupId>
        <artifactId>telegrambots</artifactId>
        <version>5.1.1</version>
    </dependency>
</dependencies>

I clicked "Load Maven Changes" and proceeded to create a class, but an error appeared

6069e36e48079953723819.png

. I tried to reload IDEA with clearing the cache, it did not help. Tell me, please, how to solve this problem?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
O
Orkhan, 2021-04-04
@Ezekiel4

Well, apparently this class was removed in the version you specified.
Here are the details:
https://github.com/rubenlagus/TelegramBots/wiki/Ho...
ApiContextInitializer.init(); has been removed and is not required anymore, instead:

TelegramBotsApi telegramBotsApi = new TelegramBotsApi(DefaultBotSession.class);

// When using webhook, create your own version of DefaultWebhook with all your parameters set.
TelegramBotsApi telegramBotsApi = new TelegramBotsApi(DefaultBotSession.class, defaultWebhookInstance);

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question