Skip to content
This repository was archived by the owner on Jan 20, 2021. It is now read-only.
This repository was archived by the owner on Jan 20, 2021. It is now read-only.

Old Handler API is deprecated (use_context) #1

@hms5232

Description

@hms5232

執行的時候應該會發現終端機上出現下列文字:

group_reposter_bot.py:34: TelegramDeprecationWarning: Old Handler API is deprecated - see https://git.io/fxJuV for details
updater = Updater(token=telegram_bot_token) # 呼叫 bot 用

查詢後發現在第 12 版的 API 中,這個裡面的參數 use_context 預設是 False,而新版(目前看官方文件應為 13 版,可是我用 pip install python-telegram-bot== 有看到最新的是 12.5 沒有 13 版耶@@)預設是 True。但目前的程式碼如果將其設定為 True 的話會出錯,因此如果發現機器人無法執行,請確認 python-telegram-bot 套件版本並設定 use_context=False

終端機提示的官方指南網址有大神翻譯的中文可看,而關於 use_context 可以參考官方文件

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions