def save_classification(bot, update):
user = update.message.from_user
logger.info('save_classification(%s) %s - %s' % (user, bot.song_cache, update.message.text))
resp = requests.get(
url='{}/user_info/{}/'.format(API_SERVER, user.id)
)
if not resp.json():
update.message.reply_text(
'Sorry {}, but I can\'t do that. Please, use "connect" command'.format(user['first_name'])
)
else:
resp = requests.get(
url='{}/classify/{}/{}'.format(
API_SERVER,
bot.song_cache[0],
ACTIVITY_KEYBOARD[0].index(update.message.text)
)
)
result = resp.json()
resp = requests.get(
url='{}/stats/{}/'.format(
API_SERVER,
user.id
)
)
result['total'] = resp.json()['total']
result['classified'] = resp.json()['classified']
update.message.reply_text(
'Result: %s \n\n Statistics:\n %s' % (result, resp.json()),
reply_markup=ReplyKeyboardMarkup([[NAVIGATION_KEYBOARD[1]]], one_time_keyboard=True, resize_keyboard=True)
)
return SAVE_SONG
评论列表
文章目录