Ошибка при запуске бота unsupported callable

Делал оплату по видео ХаудиХо, всё написал, но выдает ошибку unsupportde callable. Код в котором ошибка:

@router.message(ContentType.SUCCESSFUL_PAYMENT)
async def succ_pay(msg: Message):
    paymentinfo = msg.successful_payment.provider_payment_charge_id # Здесь должно быть .to_python() но я не знаю как это выглядит в aoigram3.3.0
    for k, v in paymentinfo:
        print(f'{k} = {v}')
    await bot.send_message(msg.chat.id, f'Платеж на сумму {msg.successful_payment.total_amount // 100} {msg.successful_payment.currency} прошёл успешно!')
    #DB.status_up(msg.from_user.id, 8)
    #await rang_up(msg)

Ошибка:

Traceback (most recent call last):
  File "C:\Users\Danil\AppData\Local\Programs\Python\Python38\lib\inspect.py", line 1123, in getfullargspec
    sig = _signature_from_callable(func,
  File "C:\Users\Danil\AppData\Local\Programs\Python\Python38\lib\inspect.py", line 2216, in _signature_from_callable
    raise TypeError('{!r} is not a callable object'.format(obj))
TypeError: <ContentType.SUCCESSFUL_PAYMENT: 'successful_payment'> is not a callable object

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "C:\Users\Danil\Desktop\So2 bot\main.py", line 10, in <module>
    from handlers import router
  File "C:\Users\Danil\Desktop\So2 bot\handlers.py", line 368, in <module>
    async def succ_pay(msg: Message):
  File "C:\Users\Danil\AppData\Local\Programs\Python\Python38\lib\site-packages\aiogram\dispatcher\event\telegram.py", line 138, in wrapper
    self.register(callback, *filters, flags=flags, **kwargs)
  File "C:\Users\Danil\AppData\Local\Programs\Python\Python38\lib\site-packages\aiogram\dispatcher\event\telegram.py", line 87, in register
    filters=[FilterObject(filter_) for filter_ in filters],
  File "C:\Users\Danil\AppData\Local\Programs\Python\Python38\lib\site-packages\aiogram\dispatcher\event\telegram.py", line 87, in <listcomp>
    filters=[FilterObject(filter_) for filter_ in filters],
  File "<string>", line 4, in __init__
  File "C:\Users\Danil\AppData\Local\Programs\Python\Python38\lib\site-packages\aiogram\dispatcher\event\handler.py", line 72, in __post_init__
    super(FilterObject, self).__post_init__()
  File "C:\Users\Danil\AppData\Local\Programs\Python\Python38\lib\site-packages\aiogram\dispatcher\event\handler.py", line 30, in __post_init__
    spec = inspect.getfullargspec(callback)
  File "C:\Users\Danil\AppData\Local\Programs\Python\Python38\lib\inspect.py", line 1132, in getfullargspec
    raise TypeError('unsupported callable') from ex
TypeError: unsupported callable


Ответы (1 шт):

Автор решения: Nqweqweqwe

Решил так:

from aiogram import F

@router.message(F.content_type == ContentType.SUCCESSFUL_PAYMENT)
→ Ссылка