telebotter / django-telegrambot

Simple app for Telegram bot in Django
BSD 3-Clause "New" or "Revised" License
14 stars 7 forks source link

Old Handler API is deprecated #6

Closed mbnoimi closed 4 years ago

mbnoimi commented 4 years ago

When I run my project I get this warning:

INFO 2020-06-23 09:53:39,915 apps Django Telegram Bot <POLLING mode>
/home/laptop/sampleproject/django_telegrambot/apps.py:225: TelegramDeprecationWarning: Old Handler API is deprecated - see https://git.io/fxJuV for details
  updater = Updater(token=token, request_kwargs=proxy, use_context=context)
INFO 2020-06-23 09:53:40,228 telegrambot Loading handlers for telegram bot

I'm using commit 5f07ec585086eca9f26d10305eca58fe21c67a6d

lukruh commented 4 years ago

I'll have a look at this in a few weeks, but since it's just a Deprecation Warning, its ok to ignore it until u plan to update ptb

lukruh commented 4 years ago

have you set use_context: True in your bot settings? Which version of ptb are you using? using this context variable is a new feature in ptb-v12 and will be the default for ptb-v13. If you wan't to use context you also have to change the arguments for your handler functions. The new handlers only take the arguments context and update, the old optional arguments user_data, chat_data such as the errors and the bot itself moved to the context dict.

Read more about that here: https://github.com/python-telegram-bot/python-telegram-bot/wiki/Transition-guide-to-Version-12.0

lukruh commented 4 years ago

If you use the context style handlers in your app and enabled it in the settings, but the warning still appears, you can reopen the Issue, or just ignore it. If we update the requirements this should raise an error, which is easy to fix.