def room_say(message, fmt="text", notify=1, color="yellow", room="standup"): print "Saying in %s room: %s" % (room, message) Room.message(room_id=state["%s_room_id" % room], message=message, message_format=fmt, notify=notify, color=color, **{"from": settings.BOT_NAME})
def room_say(message, fmt="text", notify=1, color="yellow", room="standup"): print "Saying in %s room: %s" % (room, message) Room.message( room_id=state["%s_room_id" % room], message=message, message_format=fmt, notify=notify, color=color, **{"from": settings.BOT_NAME} )
def emit(self, record, room_id=None, sender=None, color=None): if not room_id: room_id = config.HIPCHAT_ROOMID if not sender: sender = config.HIPCHAT_SENDER if not color: color = 'red' try: message = {'room_id': room_id, 'from': sender, 'notify': 1, 'color': color, 'message': record.message} Room.message(**message) except: # swallow ALL errors here. print "error"
def emit(self, record, room_id=None, sender=None, color=None): if not room_id: room_id = config.HIPCHAT_ROOMID if not sender: sender = config.HIPCHAT_SENDER if not color: color = 'red' try: message = { 'room_id': room_id, 'from': sender, 'notify': 1, 'color': color, 'message': record.message } Room.message(**message) except: # swallow ALL errors here. print "error"
if random.random() < 0.05: #5% of the time #EASTEREGG occasionally swap out image with dave winer gif original_image_url = 'http://f.cl.ly/items/2B2O014311012c1W3O0f/winer.gif' eightball_response_message = "Dave Winer says " + eightball_response_message eightball_responses.append((eightball_response_message, original_image_url)) else: #normal lucille response (gif search) gif_urls.append(original_image_url) for url in gif_urls: print url # message_text = "%s: %s" % () message = {'room_id': hipchat_room.room_id, 'from': my_username, 'message': url, 'message_format' : 'text', 'color' : 'green'} retval = Room.message(**message) print retval for eightball_response, eightball_response_gif in eightball_responses: eightball_message = "%s %s" % (eightball_response, eightball_response_gif) #determine a color based on the type of response if eightball_response in EIGHTBALL_POSITIVE_RESPONSES: eightball_color = 'green' elif eightball_response in EIGHTBALL_NEGATIVE_RESPONSES: eightball_color = 'red' else: eightball_color = 'yellow' message = {'room_id': hipchat_room.room_id, 'from': my_username, 'message': eightball_message, 'message_format' : 'text', 'color' : eightball_color} retval = Room.message(**message)
original_image_url)) else: #normal lucille response (gif search) gif_urls.append(original_image_url) for url in gif_urls: print url # message_text = "%s: %s" % () message = { 'room_id': hipchat_room.room_id, 'from': my_username, 'message': url, 'message_format': 'text', 'color': 'green' } retval = Room.message(**message) print retval for eightball_response, eightball_response_gif in eightball_responses: eightball_message = "%s %s" % (eightball_response, eightball_response_gif) #determine a color based on the type of response if eightball_response in EIGHTBALL_POSITIVE_RESPONSES: eightball_color = 'green' elif eightball_response in EIGHTBALL_NEGATIVE_RESPONSES: eightball_color = 'red' else: eightball_color = 'yellow' message = { 'room_id': hipchat_room.room_id,