I have the following code (Aiogram 3.0.0b):
from ..forms import *
@router.message(Command(commands='register_journal'))
async def initiate_register_journal_command(message: types.Message, state: FSMContext):
current_user_id = message.from_user.id
await message.reply(text="Initiating registration")
# await asyncio.sleep(3)
await message.reply(text=JournalForm.label)
await state.set_state(JournalForm.current_user_id)
await state.update_data(current_user_id=current_user_id) #worked fine
await state.set_state(JournalForm.name)
@router.message(JournalForm.name) # , CurrentUserFilter(JournalForm.current_user_id))
async def handle_registered_journal_data(message: types.Message, state: FSMContext):
name = message.text
if not Journal.objects.get(name=name):
state.set_state(JournalForm.name)
state.update_data(name=name)
group_id = message.chat.id
add_journal(name, group_id)
else: message.reply(text="Error: For the platoon's assignment the journal has already been created")
THE FORM IS:
class JournalForm(StatesGroup):
current_user_id = State()
name = State()
label = "Platoon number"
сallback_text = "A journal of visits to the platoon has been created!"
on_registration_fail_text = "An error occurred while registering a platoon, please try again later"
The problem is that when I send my platoons Name the handle_registered_journal_data is not triggered. The initiate_register_journal_command seems to work just fine.
I revealed that if I run initiate_journal_registration_command
in a group (as I did before and all the time) then it is stuck. On the other hand if I try to run it in my private chat with bot, then it works fine. I assume the problem to be that bot does not process the messages sent to the group for some reason.