T
T
Timur Burangulov2022-03-14 15:03:21
Python
Timur Burangulov, 2022-03-14 15:03:21

How can I make it so that without @dp.message_handler(commands='Gallows') - start_game() not executing @dp.message_handler()-game?

@dp.message_handler(commands='Gallowsman')
async def start_game(message: types.Message):

@dp.message_handler()
async def game(message: types.Message):
await message.answer('Enter a letter')

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
Vindicar, 2022-03-14
@Timurka_a

It's called a state machine. Simplified, you need to store for each participant information about whether he plays or not. For example, a dictionary, where the key is the participant ID and the value is the state of the game. If the ID is not in the dictionary, then the participant does not play. Kvason
's solution is bad because it works only for one interlocutor, i.e. Either everyone plays or no one plays.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question