def askme_command(self, message=None): im_from = db.IM("xmpp", message.sender) currently_answering = self._GetAnswering(im_from) question = Question.assignQuestion(im_from) if question: message.reply(TELLME_MSG % (question.question,)) else: message.reply(EMPTYQ_MSG) # Don't unassign their current question until we've picked a new one. if currently_answering: currently_answering.unassign(im_from)
def tellme_command(self, message=None): im_from = db.IM("xmpp", message.sender) asked_question = self._GetAsked(im_from) currently_answering = self._GetAnswering(im_from) if asked_question: # Already have a question message.reply(WAIT_MSG) else: # Asking a question asked_question = Question(question=message.arg, asker=im_from) asked_question.put() if not currently_answering: # Try and find one for them to answer question = Question.assignQuestion(im_from) if question: message.reply(TELLME_MSG % (question.question,)) return message.reply(PONDER_MSG)