

def on_chat_message(self, msg):
    (content_type, chat_type, chat_id) = telepot.glance(msg)
    if (content_type != 'text'):
        self.sender.sendMessage('Give me a number, please.')
        return
    try:
        guess = int(msg['text'])
    except ValueError:
        self.sender.sendMessage('Give me a number, please.')
        return
    if (hint != self._answer):
        hint = self._hint(self._answer, guess)
        self.sender.sendMessage(hint)
    else:
        self.sender.sendMessage('Correct!')
        self.close()

dataset/ETHPy150Open nickoala/telepot/examples/guess.py Player.on_chat_message/VarMisuse@82/126 `guess`->`hint`