def winner_message(chat_id, sum_bet, value, vrag_value, type, game_hash, bot): bot.send_message( chat_id, f"{type} Dice #{game_hash}\n\n💰 Сумма ставки {sum_bet} RUB\n\n👆 Ваше число {value}\n\n👇 Число соперника {vrag_value}\n\n✅Сумма выигрыша {sum_bet * 2} RUB" ) func.popoln_user_balanse(chat_id, sum_bet * 2) func.create_new_history(chat_id, game_hash, sum_bet * 2) func.update_user_count_games(chat_id) func.update_user_sum_games(chat_id, sum_bet * 2)
def play_non_true_user(chat_id, bot, game_hash, value_non_true_user): player_value = value_non_true_user game = func.get_dice_by_hash(game_hash) func.withdraw_sum_from_balanse(chat_id, game[1] / 100 * (config.games_comission)) if game[4] > player_value: winner_message(game[2], game[1], game[4], player_value, game[6], game_hash, bot) lose_message(chat_id, game[1], player_value, game[4], game[6], game_hash, bot) elif game[4] < player_value: lose_message(game[2], game[1], game[4], player_value, game[6], game_hash, bot) winner_message(chat_id, game[1], player_value, game[4], game[6], game_hash, bot) elif game[4] == player_value: func.popoln_user_balanse(chat_id, game[1]) func.popoln_user_balanse(game[2], game[1]) bot.send_message(chat_id, f"{game[6]} Dice #{game[0]}\n\n Ничья") bot.send_message(game[2], f"{game[6]} Dice #{game[0]}\n\n Ничья") func.delete_dice_game_by_hash(game_hash)
def get_second_player_value_dice_game(message, bot, game_hash, value): chat_id = message.chat.id player_value = message.dice.value + value game = func.get_dice_by_hash(game_hash) func.withdraw_sum_from_balanse(chat_id, game[1] / 100 * (100 + config.games_comission)) if game[4] > player_value: winner_message(game[2], game[1], game[4], player_value, game[6], game_hash, bot) lose_message(chat_id, game[1], player_value, game[4], game[6], game_hash, bot) elif game[4] < player_value: lose_message(game[2], game[1], game[4], player_value, game[6], game_hash, bot) winner_message(chat_id, game[1], player_value, game[4], game[6], game_hash, bot) elif game[4] == player_value: func.popoln_user_balanse(chat_id, game[1]) func.popoln_user_balanse(game[2], game[1]) bot.send_message(chat_id, f"{game[6]} Dice #{game[0]}\n\n Ничья") bot.send_message(game[2], f"{game[6]} Dice #{game[0]}\n\n Ничья") func.delete_dice_game_by_hash(game_hash)