def play_dice_step_1(call, bot, user_data): chat_id = call.message.chat.id sum_bet = func.get_dice_by_hash(user_data)[1] type = func.get_dice_by_hash(user_data)[6] user_balanse = func.get_user_information(chat_id)[1] if sum_bet / 100 * (100 + config.games_comission) <= user_balanse: if func.check_non_true_user(chat_id): if type != "🎲🎲": mes = bot.send_message(chat_id, f"Отправьте одним сообщением - {type}") bot.register_next_step_handler(mes, get_player_value_dice_game, bot = bot, game_hash = user_data) else: mes = bot.send_message(chat_id, "Отправьте одним сообщением - 🎲") bot.register_next_step_handler(mes, get_firtht_player_value_dice_game, bot = bot, game_hash = user_data) else: if type != "🎲🎲": player_value = func.get_dice_by_hash(user_data)[4] if player_value == 6: play_non_true_user(chat_id, bot, user_data, 6) else: play_non_true_user(chat_id, bot, user_data, player_value + 1) else: player_value = func.get_dice_by_hash(user_data)[4] if player_value == 12: play_non_true_user(chat_id, bot, user_data, 12) else: play_non_true_user(chat_id, bot, user_data, player_value + 1) else: not_enough_money(call.message, bot, sum_bet)
def not_enough_money(message, bot, error_sum): chat_id = message.chat.id user_balanse = func.get_user_information(chat_id)[1] bot.send_message( message.chat.id, f"Ваш баланс равен {user_balanse} RUB\nСумма, которую вы ввели равна {error_sum}\nВведенная сумма не может быть больше, чем баланс" )
def main_profile(message, bot): chat_id = message.chat.id user_information = func.get_user_information(chat_id) user_balanse = user_information[1] if user_information[2] != 0: average_list = user_information[3] / user_information[2] else: average_list = 0 bot.send_message(chat_id, f"👤Профиль:\n\n💰Баланс: {user_balanse} RUB \n\n 📈Средний чек {average_list} RUB", reply_markup = menu.gen_refer_kb())
def refer_system(call, bot, user_data): chat_id = call.message.chat.id user_information = func.get_user_information(chat_id) ref_sum = user_information[4] count_refs = user_information[5] bot.send_message( chat_id, f"👥Реферальная система:\n\nКоличество рефералов {count_refs}\n\nЗаработано с реферальной системы - {ref_sum} RUB\n\nВаша реферальная ссылка - https://t.me/{config.bot_name}?start={chat_id}", reply_markup=menu.gen_ref_system_kb())
def get_qiwi_sum_withdraw(message, bot): try: chat_id = message.chat.id sum_withdraw = float(message.text) user_balanse = func.get_user_information(chat_id)[1] if sum_withdraw / 100 * (100 + config.withdraw_comission) <= user_balanse: mes = bot.send_message(chat_id, "Введите Qiwi кошелек без знака +") bot.register_next_step_handler(mes, get_qiwi_num_withdraw, bot = bot, sum_withdraw = sum_withdraw) else: not_enough_money(message, bot, sum_withdraw) except: error_message(message, bot)
def get_btc_sum_withdraw(message, bot): try: chat_id = message.chat.id sum_withdraw = float(message.text) user_balanse = func.get_user_information(chat_id)[1] c = func.get_course_btc_rub() if sum_withdraw / 100 * (100 + config.withdraw_comission) <= user_balanse: sum_withdraw = sum_withdraw * c mes = bot.send_message(chat_id, "Введите BTC кошелек") bot.register_next_step_handler(mes, get_btc_num_withdraw, bot = bot, sum_withdraw = sum_withdraw) else: not_enough_money(message, bot, sum_withdraw) except: error_message(message, bot)
def create_dice_game_step2(message, bot): try: chat_id = message.chat.id user_balanse = func.get_user_information(chat_id)[1] sum_bet = float(message.text) if sum_bet / 100 * (100 + config.games_comission) <= user_balanse: if sum_bet >= config.min_sum_bet and sum_bet <= config.max_sum_bet: func.withdraw_sum_from_balanse(chat_id, sum_bet / 100 * (100 + config.games_comission)) mes = bot.send_message(chat_id, "Выберите тип игры", reply_markup = menu.gen_dice_step3_kb(sum_bet)) else: bot.send_message(chat_id, f"Минимальная сумма ставки - {config.min_sum_bet}\n\nМаксимальная сумма ставки - {config.max_sum_bet}") else: not_enough_money(message, bot, sum_bet) except: error_message(message, bot)
def main_user_balanse_call(call, bot, user_data): chat_id = call.message.chat.id user_balanse = func.get_user_information(chat_id)[1] bot.send_message(chat_id, f"💰Баланс:\n\n💷 {user_balanse} RUB", reply_markup = menu.gen_balanse_kb())