zveronline / docker-sopds

Dockerfile to build a Simple OPDS server docker image.
http://www.sopds.ru
The Unlicense
15 stars 21 forks source link

telegram bot not working (no answers) #18

Open JiLleON opened 2 years ago

JiLleON commented 2 years ago

thanks for your work, I didn't find any mention of this error logs sopds/opds_catalog/log/sopds_telebot.log after setting up in logs

/sopds/opds_catalog/management/commands/sopds_telebot.py:348: TelegramDeprecationWarning: RegexHandler is deprecated. See https://git.io/fxJuV for more info
  download_handler = RegexHandler('^/download\d+$',self.downloadBooks)
/usr/local/lib/python3.10/site-packages/telegram/ext/regexhandler.py:135: TelegramDeprecationWarning: message_updates is deprecated. See https://git.io/fxJuV for more info
  super().__init__(
/usr/local/lib/python3.10/site-packages/telegram/ext/regexhandler.py:135: TelegramDeprecationWarning: channel_post_updates is deprecated. See https://git.io/fxJuV for more info
  super().__init__(
/usr/local/lib/python3.10/site-packages/telegram/ext/regexhandler.py:135: TelegramDeprecationWarning: edited_updates is deprecated. See https://git.io/fxJuV for more info
  super().__init__(
/sopds/opds_catalog/management/commands/sopds_telebot.py:355: TelegramDeprecationWarning: The argument `clean` of `start_polling` is deprecated. Please use `drop_pending_updates` instead.
  updater.start_polling(clean=True)
2022-03-25 19:15:08,421 INFO     Scheduler started

after send /start to bot

Traceback (most recent call last):
  File "/usr/local/lib/python3.10/site-packages/telegram/ext/dispatcher.py", line 555, in process_update
    handler.handle_update(update, self, check, context)
  File "/usr/local/lib/python3.10/site-packages/telegram/ext/handler.py", line 198, in handle_update
    return self.callback(update, context)
  File "/sopds/opds_catalog/management/commands/sopds_telebot.py", line 30, in wrapper
    result =  func(self, bot, update)
  File "/sopds/opds_catalog/management/commands/sopds_telebot.py", line 40, in wrapper
    return func(self, bot, update)
  File "/sopds/opds_catalog/management/commands/sopds_telebot.py", line 109, in startCommand
    bot.sendMessage(chat_id=update.message.chat_id, text=_("%(subtitle)s\nHello %(username)s! To search for a book, enter part of her title or author:")%
AttributeError: 'Update' object has no attribute 'sendMessage'

after sending book name

Traceback (most recent call last):
  File "/usr/local/lib/python3.10/site-packages/telegram/ext/dispatcher.py", line 555, in process_update
    handler.handle_update(update, self, check, context)
  File "/usr/local/lib/python3.10/site-packages/telegram/ext/handler.py", line 198, in handle_update
    return self.callback(update, context)
  File "/sopds/opds_catalog/management/commands/sopds_telebot.py", line 30, in wrapper
    result =  func(self, bot, update)
  File "/sopds/opds_catalog/management/commands/sopds_telebot.py", line 40, in wrapper
    return func(self, bot, update)
  File "/sopds/opds_catalog/management/commands/sopds_telebot.py", line 190, in getBooks
    query=update.message.text
AttributeError: 'CallbackContext' object has no attribute 'message'

after sending /start with SOPDS_TELEBOT_AUTH=True

Traceback (most recent call last):
  File "/usr/local/lib/python3.10/site-packages/telegram/ext/dispatcher.py", line 555, in process_update
    handler.handle_update(update, self, check, context)
  File "/usr/local/lib/python3.10/site-packages/telegram/ext/handler.py", line 198, in handle_update
    return self.callback(update, context)
  File "/sopds/opds_catalog/management/commands/sopds_telebot.py", line 30, in wrapper
    result =  func(self, bot, update)
  File "/sopds/opds_catalog/management/commands/sopds_telebot.py", line 45, in wrapper
    query = update.message if update.message else update.callback_query.message
AttributeError: 'CallbackContext' object has no attribute 'message'
nomyownnet commented 2 years ago

You can add 'use_context = False' to updater in opds_catalog/management/commands/sopds_telebot.py


 344       try:
 345           updater = Updater(token=config.SOPDS_TELEBOT_API_TOKEN, use_context=False)