def random(message): db = Db(db_dir) today = db.get_today_crusade() if today: bot.send_message(chat_id, 'Сегодня уже выбран - ' + str(today[0][0])) else: places = db.get_places_for_random() shuffle(places) db.add_crusade(places[0][0]) bot.send_message(chat_id, 'Выбор на сегодня - ' + str(places[0][1]))
def change(message, place_id): if message: db = Db(db_dir) place = db.get_place(place_id) today = db.get_today_crusade() if today: db.update_crusade(place[0]) else: db.add_crusade(place[0]) return str(place[1])