[Python] Dispatcher.__init__() takes 1 positional argument but 2 were given

Discussão em 'Python' iniciado por Stack, Março 16, 2025.

  1. Stack

    Stack Membro Participativo

    What am I doing wrong and why am I getting this error?

    TOKEN_API = "1"

    from aiogram import Bot, Dispatcher, types, executor

    bot = Bot(token="TOKEN_API")
    dp = Dispatcher(bot)

    @dp.message_handler(commands=["start"])
    async def send_random_letter(message : types.Message):
    await message.answer("hi,print /generate_pictures, to start")


    I get an error:

    dp = Dispatcher(bot)
    ^^^^^^^^^^^^^^^
    TypeError: Dispatcher.__init__() takes 1 positional argument, but 2 were given


    Please help.

    I only started and I don't know what to write.

    Continue reading...

Compartilhe esta Página