So I'm making a IRC betting bot. Basically the game/bot has three states of taking-in chat.
State 1 : Betting If anyone says "!bet team money" parse it and record.
State 2 : Battling Take nothing in, no more !bet etc. Just watch.
State 3 : Waiting/Bank Don't take bets. But take-in "!bank" and print out the users money count.
Right now for each of my bot message parsers I have a big fat IF.
if (global_state == BETTING): blah blah bah
AND I'm starting to need to have my bot do stuff when the state changes. So now I'm starting to do this (which hurts my soul a little every time I read it)
if (global_state == BETTING && past_state == WAITING): do blah stuff like reset the bet money
As some of you might have noticed I'm using Python, but this problem definitely is not python-only. What should I do instead?