Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update payment.py #4005

Merged
merged 1 commit into from Dec 22, 2022
Merged

Update payment.py #4005

merged 1 commit into from Dec 22, 2022

Commits on Dec 19, 2022

  1. Update payment.py

    LINE 88 LINE 90
    causing event.message.from_id error:
    2022-12-19 16:51:10,027 - telethon.client.updates - ERROR - Unhandled exception on payment_received_handler
    Traceback (most recent call last):
      File "C:\Users\User\PycharmProjects\borpayment\venv\Lib\site-packages\telethon\client\updates.py", line 497, in _dispatch_update
        await callback(event)
      File "C:\Users\User\PycharmProjects\borpayment\main.py", line 87, in payment_received_handler
        await bot.send_message(event.message.from_id, 'Thank you for buying product A!')
      File "C:\Users\User\PycharmProjects\borpayment\venv\Lib\site-packages\telethon\client\messages.py", line 827, in send_message
        entity = await self.get_input_entity(entity)
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
      File "C:\Users\User\PycharmProjects\borpayment\venv\Lib\site-packages\telethon\client\users.py", line 443, in get_input_entity
        peer = utils.get_peer(peer)
               ^^^^^^^^^^^^^^^^^^^^
      File "C:\Users\User\PycharmProjects\borpayment\venv\Lib\site-packages\telethon\utils.py", line 997, in get_peer
        _raise_cast_fail(peer, 'Peer')
      File "C:\Users\User\PycharmProjects\borpayment\venv\Lib\site-packages\telethon\utils.py", line 138, in _raise_cast_fail
        raise TypeError('Cannot cast {} to any kind of {}.'.format(
    TypeError: Cannot cast NoneType to any kind of Peer.
    
    Changing from event.message.from_id to event.message.peer_id.user_id solves it
    yumupdate committed Dec 19, 2022
    Copy the full SHA
    8a514c2 View commit details
    Browse the repository at this point in the history