Не помещается асинхронная функция в переменную telegram bot aiogram python

Я хочу поместить функцию в главную переменную, где они будут лежать, чтобы потом сделать таких функций много и вызвать их рандомно методом random.choice(testbb), а в самих функциях будет желать текст вместе с инлайн кнопками и отправка их ботом.

Но когда я помещаю функцию в переменную вылазит ошибка:

D:\papka\user\testpy>test.py
Traceback (most recent call last):
  File "D:\papka\user\testpy\test.py", line 36, in <module>
    testbb = [asyncio.run(test(message))]
  File "C:\Users\user\AppData\Local\Programs\Python\Python39\lib\asyncio\runners.py", line 44, in run
    return loop.run_until_complete(main)
  File "C:\Users\user\AppData\Local\Programs\Python\Python39\lib\asyncio\base_events.py", line 642, in run_until_complete
    return future.result()
  File "D:\papka\user\testpy\test.py", line 34, in test
    await bot.send_message(message.chat.id, b)
AttributeError: module 'aiogram.types.message' has no attribute 'chat'

А вот код:

from aiogram.types import message
from aiogram import types, executor
import asyncio
import random

from aiogram import Bot, Dispatcher
import logging

TOKEN = 'токен я скрыл'

logging.basicConfig(level=logging.INFO)

bot = Bot(token=TOKEN)
dp = Dispatcher(bot)

@dp.message_handler(commands=['start'])
async def process_start_command(message: types.Message):
    await bot.send_message(message.chat.id, random.choice(testbb))

async def test(message: types.Message):
    b = 'это текст пример.\nЕсли это сработает я буду рад'
    await bot.send_message(message.chat.id, b)

testbb = [asyncio.run(test(message))]

if __name__ == "__main__":
   executor.start_polling(dp, skip_updates=True,)

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