Skip to content

Commit

Permalink
add commit_message to housekeeping.py and botrunner.py
Browse files Browse the repository at this point in the history
  • Loading branch information
mjays committed Aug 31, 2012
1 parent 2b89dc6 commit 9935aba
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 8 deletions.
4 changes: 3 additions & 1 deletion botrunner.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,12 +64,14 @@
if GIT_BRANCH and (GIT_BRANCH==ref):
# construct quit messge for bot
commit_author = "A ghost"
commit_message = "mysterious games"
try:
commits = hookserver_message.payload[ 'commits' ]
commit_author = commits[0]['author']['name']
commit_message = commits[0]['message']
except Exception, e:
logging.info( e )
message_out = housekeeping.update_message_for_name( commit_author )
message_out = housekeeping.update_message_for_name( commit_author, commit_message )
bot_thread.stop( message_out )
bot_thread = None
# drop to outer loop; restart bot_thread
Expand Down
14 changes: 7 additions & 7 deletions messages/housekeeping.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@
import random

update_messages = [
Template( "/me goes glassy eyed for a moment as an update is recieved. If he doesn't come back it's $name's fault." ),
Template( "/me runs from the bar, screaming something about $name and an update." ),
Template( "/me bursts into the cubicle in real need of a slash. $name is caught with their pants down." ),
Template( "/me rings the bell - the $name updates are here. Get your updates." ),
Template( "/me spills the gossip, $name was caught fiddling in the back a minute ago." )
Template( "/me goes glassy eyed for a moment as an update is recieved. If he doesn't come back it's $name's fault. He shouldn\'t have done $message." ),
Template( "/me runs from the bar, screaming something about $name and $message." ),
Template( "/me bursts into the cubicle in real need of a slash. $name is caught with their pants down, playing $message." ),
Template( "/me rings the bell - the $name updates are here. Get your $message." ),
Template( "/me spills the gossip, $name was caught fiddling in the back a minute ago on $message" )
]

new_chat_messages = [
Expand All @@ -17,9 +17,9 @@
"/me tells Gregory Povey it’s okay to post now."
]

def update_message_for_name( name ):
def update_message_for_name( name, message ):
template = random.choice( update_messages )
return template.substitute( name=name )
return template.substitute( name=name, message=message )

def new_chat_message():
message = random.choice( new_chat_messages )
Expand Down

0 comments on commit 9935aba

Please sign in to comment.