S
S
sousagemonster2021-04-19 22:54:24
Python
sousagemonster, 2021-04-19 22:54:24

TypeError: ... handler() got multiple values ​​for argument '...' how to solve?

@dp.message_handler(commands='broadcast')
async def broadcast_command_handler(state: FSMContext):
    await message.answer('Введите текст для начала рассылки:')
    await state.set_state('broadcast_text')
@dp.message_handler(state='broadcast_text', content_types=types.ContentTypes.ANY)
async def start_broadcast(state: FSMContext):
    await state.finish()
    joinedFile1 = open("c:/users/sousa/bot/json1.txt", "r")
    for line in joinedFile1:
        await MessageBroadcaster(line, msg).run()


When running the command, it gives an error:
TypeError: broadcast_command_handler() got multiple values for argument 'state'

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
soremix, 2021-04-19
@sousagemonster

All functions must have a parameter message, then you can already stateinsert
https://docs.aiogram.dev/en/latest/examples/finite...
How can I immediately add information to the State (aiogram) storage?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question