Aiogram Dispatcher() takes no arguments
Пишу бота с aiogram, но PyCharm ругает Dispatcher
и executor
со словами, что они пустые:
import openai
from aiogram import Bot, types
from aiogram.dispatcher import Dispatcher
from aiogram.utils import executor
token = 'токен тг бота'
openai.api_key = 'аи ключ'
bot = Bot(token)
dp = Dispatcher(bot)
@dp.message_handler()
async def send(message : types.Message):
response = openai.Completion.create(
model='text-davinci-004',
promt=message.text,
temperature=0.9,
max_tokens=1000,
top_p=1.0,
freauency_penalty=0.0,
presence_penalty=0.6,
stop=["You"]
)
await message.answer(response['choices'][0]['text'])
executor.start_polling(dp, skip_updates=True)
Ошибка
Traceback (most recent call last):
File "c:\Users\Грачики\VC\32", line 11, in <module>
dp = Dispatcher(bot)
^^^^^^^^^^^^^^^ TypeError: Dispatcher() takes no arguments