def reward_users(bot, job): levels_percentage = tariffs.get_referral_levels_percentage() deposit_reward = User.deposit * User.deposit_reward query = User.update( balance=(User.balance + User.deposit * User.deposit_reward + User.first_level_partners_deposit * User.deposit_reward * levels_percentage[0] + User.second_level_partners_deposit * User.deposit_reward * levels_percentage[1] + User.third_level_partners_deposit * User.deposit_reward * levels_percentage[2]), sum_deposit_reward=User.sum_deposit_reward + deposit_reward).where(User.deposit >= tariffs.eth_minimal_deposit()) query.execute() users = User.select().where(User.deposit >= tariffs.eth_minimal_deposit()) for user in users: deposit_reward = user.deposit * user.deposit_reward first_level_reward = user.first_level_partners_deposit * user.deposit_reward * levels_percentage[ 0] second_level_reward = user.second_level_partners_deposit * user.deposit_reward * levels_percentage[ 1] third_level_reward = user.third_level_partners_deposit * user.deposit_reward * levels_percentage[ 2] bot.send_message(chat_id=user.chat_id, text=f'You got a charge:\n' f'Deposit: {deposit_reward:.7f} ETH\n' f'1 level: {first_level_reward:.7f} ETH\n' f'2 level: {second_level_reward:.7f} ETH\n' f'3 level: {third_level_reward:.7f} ETH')
def deposit(user_deposit, user_balance, user_reward, sum_deposit_reward): text = f'Deposit: {user_deposit:.7f} ETH. \n' if user_deposit >= tariffs.eth_minimal_deposit(): text += f'Balans: {user_balance:.7f} ETH. \n' \ f'Edit rate: {user_reward * 100}% in a day.\n' else: text += f'Initial deposit: {tariffs.eth_minimal_deposit()} ETH\n' text += 'Transfer from balance to deposit: /transfer_deposit\n' \ 'Balance transfer to user: /transfer_user' return text
def deposit(user_deposit, user_balance, user_reward, sum_deposit_reward): text = f'Депозит: {user_deposit:.7f} ETH. \n' if user_deposit >= tariffs.eth_minimal_deposit(): text += f'Баланс: {user_balance:.7f} ETH. \n' \ f'Процентная ставка: {user_reward * 100}% в день.\n' else: text += f'Начальный депозит: {tariffs.eth_minimal_deposit()} ETH\n' text += 'Перевод из баланса в депозит: /transfer_deposit\n' \ 'Перевод баланса пользователю: /transfer_user' return text
def notify_inactive_users(bot, job): four_days_ago = datetime.datetime.now() - datetime.timedelta(days=4) inactive_users = User.select( User.chat_id).where((User.created_at < four_days_ago) & (User.deposit < tariffs.eth_minimal_deposit())) text = f'We see that you have not started making money with us..\n' \ f'If you have questions - write to us in technical support and we will help:\n' \ f'{config.get_support_account()}' for user in inactive_users: bot.send_message(chat_id=user.chat_id, text=text)
def notify_inactive_users(bot, job): four_days_ago = datetime.datetime.now() - datetime.timedelta(days=4) inactive_users = User.select(User.chat_id).where( (User.created_at < four_days_ago) & (User.deposit < tariffs.eth_minimal_deposit()) ) text = f'Мы видим, что вы ещё не начали зарабатывать с нами.\n' \ f'Если у вас есть вопросы - напишите нам в техподдержку и мы поможем:\n' \ f'{config.get_support_account()}' for user in inactive_users: bot.send_message( chat_id=user.chat_id, text=text )