Telethon icon indicating copy to clipboard operation
Telethon copied to clipboard

"TypeError: expected string or bytes-like object!" while handling CallbackQuery

Open New-dev0 opened this issue 3 years ago • 0 comments

Checklist

  • [x] The error is in the library's code, and not in my own.
  • [x] I have searched for this issue before posting it and there isn't a duplicate.
  • [x] I ran pip install -U https://github.com/LonamiWebs/Telethon/archive/master.zip and triggered the bug in the latest version.

Steps to Reproduce

  1. Handle Any callback event with events.CallbackQuery.
  2. Send any Game via same bot.
  3. Press Callback Button and Error

Traceback

File "/home/name/.local/lib/python3.9/site-packages/telethon/client/updates.py", line 460, in _dispatch_update
    filter = builder.filter(event)
  File "/home/name/.local/lib/python3.9/site-packages/telethon/events/callbackquery.py", line 115, in filter
    event.data_match = event.pattern_match = self.match(event.query.data)
TypeError: expected string or bytes-like object

Misc

  • Telegram send Callback Query same as Game's ShortName if it's Game.
  • I believe, events.CallbackQuery should allow using Game ShortName in pattern/data.
  • And When Game Callback button is pressed, data of that query turns None and game_short_name is Present.
  • I tried doing that this way

New-dev0 avatar Dec 02 '21 11:12 New-dev0