rubenlagus / TelegramBots

Java library to create bots using Telegram Bots API
https://telegram.me/JavaBotsApi
MIT License
4.77k stars 1.22k forks source link

TelegramLongPollingBot marked as deprecated but no hints on how to solve the problem #1202

Closed Polve closed 1 year ago

Polve commented 1 year ago

Following the "Getting started" guide to create a base bot I extend the class TelegramLongPollingBot but while compiling I get this deprecation error:

warning: [deprecation] TelegramLongPollingBot() in TelegramLongPollingBot has been deprecated

The problem is that both in the guide and in the API there is no hint on the way forward and what is the "right" solution to avoid the deprecation.

Chase22 commented 1 year ago

It's not the class but the constructor that is deprecated. The issues with documentation are known and i fixed them in #1194

You can find the updated GettingStarted here: https://github.com/Chase22/TelegramBots/blob/720f2767f5df101bbbb0bb868b404a579e495708/TelegramBots.wiki/Getting-Started.md#building-your-first-bot

Tldr: You need to pass your bot token into the super call in your bot classes constructor

Polve commented 1 year ago

Thank you for the details