import asyncio
import logging
from aiogram import html
from aiogram import Bot, Dispatcher, types
from aiogram.filters import Command, CommandObject
from datetime import datetime
from aiogram.types import ContentType
logging.basicConfig(level=logging.INFO)
bot = Bot(token='BOT-TOKEN', parse_mode='HTML')
dp = Dispatcher()
@dp.message(types.ContentType.TEXT)
async def extract_data(message: types.Message):
data = {
"url": "<N/A>",
"email": "<N/A>",
"code": "<N/A>"
}
entities = message.entities or []
for item in entities:
if item.type in data.keys():
data[item.type] = item.extract(message.text)
await message.reply(
"Вот что я нашел:\n"
f"URL: {html.quote(data['url'])}\n"
f"E-mail: {html.quote(data['email'])}\n"
f"Пароль: {html.quote(data['code'])}"
)
async def main():
await dp.start_polling(bot, mylist=list[str])
if __name__ == '__main__':
asyncio.run(main())
Сама ошибка:
Traceback (most recent call last):
File "C:\Users\User\AppData\Local\Programs\Python\Python310\lib\inspect.py", line 1285, in getfullargspec
sig = _signature_from_callable(func,
File "C:\Users\User\AppData\Local\Programs\Python\Python310\lib\inspect.py", line 2392, in _signature_from_callable
raise TypeError('{!r} is not a callable object'.format(obj))
TypeError: 'text' is not a callable object
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "D:\Python Lessons\aiogram\python-lesson\main.py", line 15, in <module>
async def extract_data(message: types.Message):
File "D:\Python Lessons\aiogram\python-lesson\venv\lib\site-packages\aiogram\dispatcher\event\telegram.py", line 127, in wrapper
self.register(callback, *filters, flags=flags)
File "D:\Python Lessons\aiogram\python-lesson\venv\lib\site-packages\aiogram\dispatcher\event\telegram.py", line 75, in register
filters=[FilterObject(filter_) for filter_ in filters],
File "D:\Python Lessons\aiogram\python-lesson\venv\lib\site-packages\aiogram\dispatcher\event\telegram.py", line 75, in <listcomp>
filters=[FilterObject(filter_) for filter_ in filters],
File "<string>", line 5, in __init__
File "D:\Python Lessons\aiogram\python-lesson\venv\lib\site-packages\aiogram\dispatcher\event\handler.py", line 71, in __post_init__
super(FilterObject, self).__post_init__()
File "D:\Python Lessons\aiogram\python-lesson\venv\lib\site-packages\aiogram\dispatcher\event\handler.py", line 29, in __post_init__
self.spec = inspect.getfullargspec(callback)
File "C:\Users\User\AppData\Local\Programs\Python\Python310\lib\inspect.py", line 1295, in getfullargspec
raise TypeError('unsupported callable') from ex
TypeError: unsupported callable
Помогите новичку, пожалуйста