Permalink
Browse files

one more README adjsutment and closed #1

  • Loading branch information...
1 parent bf84029 commit e3169a7c594aaf3a12997b7b155868e6b6405fe3 @johnzimmerman committed Mar 14, 2012
Showing with 7 additions and 5 deletions.
  1. +2 −0 README
  2. +5 −5 foosbot.py
View
2 README
@@ -5,6 +5,8 @@
| | | (_) | (_) \__ \ |_) | (_) | |_
|_| \___/ \___/|___/____/ \___/ \__|
+
+
We play a lot of table football (foosball) at the office. At first, one of the employees built a random team generator to mix up the teams as much as possible. After a short while that team generator grew into FoosBot, an IM bot that uses the XMPP protocol to communicate.
FoosBot allows anyone to create matches and broadcast messages when someone wants to play. The first three responders to that message will be entered into a match with the match creator. FoosBot also allows players to enter game scores while tracking win/loss records for teams and players. If you have any suggestions or feedback on FoosBot please let me know. Or, fork it and adapt it to your own needs.
View
@@ -193,17 +193,19 @@ def handle_message(self, sender, message):
reply = 'Match requested. I will notify the others.'
elif (message == 'y' or message == 'yes') and bot.match_requested == True:
+ reply = None
# Do not allow a registered user to be added more than once
if sender in bot.match_players:
- #The following message won't be sent. FIX LATER
- reply = "You are already playing in the next match."
-
+ bot.send(sender, "You are already playing in the next match.")
+ return
# Check for 4 players
if len(bot.match_players) < 4:
bot.match_players.append({'id' : self.player_id, 'jabber_id' : sender })
# notify game initiator as players join
bot.send(bot.match_players[0]['jabber_id'],
'%s has joined the match.' % bot.active_players[sender])
+ # notify the player
+ reply = "You joined the match. Get ready!"
if len(bot.match_players) == 4:
# Generate teams
match_data = create_match(bot.match_players)
@@ -224,8 +226,6 @@ def handle_message(self, sender, message):
del bot.match_players[:]
bot.active_players.clear()
bot.match_requested = False
-
- reply = None
elif message == "score":
self.entry_mode = "scoring"

0 comments on commit e3169a7

Please sign in to comment.