コード例 #1
0
 def main(self):
     try:
         while True:
             for client in Hour_queue.objects.filter(finished=False):
                 if client.username not in self.clients:
                     Thread(target=self.boost, args=(client, ),
                            daemon=True).start()
             sleep(1.5)
             if os.path.isfile('debugh'):
                 os.remove('debugh')
                 while True:
                     try:
                         command = input(colored('[Debug]: ', 'yellow'))
                         if command != 'cont' and command != 'continue':
                             exec(command)
                         else:
                             print(colored('[Debug] Exiting...', 'yellow'))
                             break
                     except:
                         print(colored(exceptionTraceback(), 'yellow'))
     except KeyboardInterrupt:
         collect()
         print(colored('collected garbage, exiting...', 'yellow'))
         exit(0)
     except:
         print(colored(exceptionTraceback(), 'red'))
         print(colored('[Hour Boost] Failed. Restarting', 'red'))
         sleep(5)
         self.__init__()
コード例 #2
0
 def error(self, db, message=None, autoRestart=True):
     if message is None:
         message = '[Hour Boost - %s] დაფიქსირდა შეცდომა' % db.username
     if db.username in self.clients:
         print(
             colored('[Hour Boost] %s 🗙 Failed Hour Boost' % db.username,
                     'red'))
         del self.clients[db.username]
         db.errlog = exceptionTraceback()
         db.stopped = True
         db.finished = True
         db.save()
         user = User.objects.get(username=db.user)
         user.seen = False
         user.save()
         notify(user, message)
         # if user has remaining backup codes, automatically restart it
         if autoRestart and db.authcode != '' and db.authcode != None:
             print(
                 colored(
                     '[Hour Boost] %s Will Use Remaining Backup Code(s)' %
                     db.username, 'green'))
             db.stopped = False
             db.finished = False
             db.errlog = ''
             db.save()
         else:
             notify(
                 user,
                 '[Hour Boost - %s] შეიყვანეთ Backup კოდები' % db.username)
コード例 #3
0
ファイル: utils.py プロジェクト: Phalelashvili/steamboost.ge
def notify(user, msg, url='https://steamboost.ge/', ttl=10000, log=True):
    if log:  # not all notifications are push notifications
        Notifications.objects.create(to=user.username, sender='System', time=datetime.datetime.now(
        ), message=msg, cause=str(exceptionTraceback()))
    try:
        send_user_notification(user=user, payload={'head': 'steamboost.ge', 'body': msg,
                                                   'icon': 'https://steamboost.ge/static/img/notification.ico', 'url': url}, ttl=ttl)
    except:
        pass
コード例 #4
0
 def loginBot(self, bot_creds):
     try:
         self.bots[bot_creds['username']] = SteamClient('not_needed')
         self.bots[
             bot_creds['username']].time_banned = datetime.datetime.now(
             ) - datetime.timedelta(1, 1, 0)
         while True:
             try:
                 if 'extra' in bot_creds:
                     self.bots[bot_creds['username']].login(
                         bot_creds['username'],
                         bot_creds['password'],
                         bot_creds['extra'],
                         proxies={'https': proxy.getRandom()},
                         timeout=15)
                 else:
                     self.bots[bot_creds['username']].login_with_authcode(
                         bot_creds['username'],
                         bot_creds['password'],
                         bot_creds['authcode'],
                         proxies={'https': proxy.getRandom()},
                         timeout=15)
                 break
             except:
                 # print(colored(exceptionTraceback(), 'red'))
                 print(
                     colored(
                         '[Comment Boost] Bot %s failed to log in, retrying in 10 seconds'
                         % bot_creds['username'], 'red'))
                 sleep(10)
         print(
             colored(
                 '[Comment Boost] Bot %s logged in' % bot_creds['username'],
                 'green'))
         self.bots[bot_creds['username']].steam64id = self.bots[
             bot_creds['username']].login_response.json(
             )['transfer_parameters']['steamid']
         Thread(target=self.keepAlive,
                args=(self.bots[bot_creds['username']], bot_creds)).start()
     except:
         print(
             colored(
                 '[Comment Boost] ' + bot_creds['username'] + ' ' +
                 exceptionTraceback(), 'red'))
コード例 #5
0
ファイル: views.py プロジェクト: Phalelashvili/steamboost.ge
def avatarFinder_api(request):
    user = request.user
    if not user.is_authenticated:
        return HttpResponse(
            f'extension-ის გამოსაყენებლად გაიარეთ ავტორიზაცია საიტზე <a href="https://steamboost.ge" target="_blank" style="color: red">steamboost.ge</a>',
            status=400)
    if user.extension_avatarFinder is None:
        return HttpResponse(
            f'extension ნაყიდი არაა %s-ზე. საყიდლად მოგვწერეთ <a href=\'{DISCORD_INVITE}\' target=\'_blank\' style=\'color: red\'>დისქორდზე</a>'
            % user.username,
            status=400)
    if datetime.datetime.now() > user.extension_avatarFinder:
        return HttpResponse(
            f'ვადა ამოიწურა ({user.extension_avatarFinder}) გასანახლებლად მოგვწერეთ <a href=\'{DISCORD_INVITE}\' target=\'_blank\' style=\'color: red\'>დისქორდზე</a>',
            status=400)
    if GetUserIP(request) != user.ip:
        return HttpResponse(
            f'თქვენი IP არ ემთხვევა {HideUserIP(user.ip)}-ს. მოგვწერეთ <a href=\'{DISCORD_INVITE}\' target=\'_blank\' style=\'color: red\'>დისქორდზე</a>',
            status=400)

    avatar = request.GET.get('avatar', None)

    if not request.user.is_superuser:
        avatarFinder_Log.objects.create(username=user.username,
                                        avatar=avatar,
                                        time=datetime.datetime.now(),
                                        allProfiles=True)

    game = request.GET.get('game', None)  # from pizza
    try:
        game = int(game)
    except:
        game = None

    if avatar is None:
        return HttpResponse('missing avatar')

    users = SteamTracker_User.objects.using('steamtracker').filter(
        avatar=avatar)
    data = []
    sortedData = {}
    steamids = []

    for user in users:
        steamids.append(str(user.steam64id))

    try:
        data = requests.get(
            'https://api.steampowered.com/ISteamUser/GetPlayerSummaries/v2/?key=%s&format=json&steamids=%s'
            % (API_KEY, ','.join(steamids))).json()['response']['players']

        for player in data:
            try:
                sortedData[player['steamid']] = player
            except:
                pass

        for user in users:
            try:
                gamesOwned = requests.get(
                    f'http://api.steampowered.com/IPlayerService/GetOwnedGames/v0001/?key={API_KEY}&format=json&steamid={user.steam64id}'
                ).json()['response']['games']

                if game != None and game in [i["appid"] for i in gamesOwned]:
                    user.hasGame = True
            except:
                user.hasGame = True

            try:
                user.name = sortedData[str(user.steam64id)]['personaname']
                user.visibilityState = 'Public' if sortedData[str(
                    user.steam64id
                )]['communityvisibilitystate'] == 3 else 'Private'
                user.profileStatus = 'offline' if sortedData[str(
                    user.steam64id)].get('personastate', 0) == 0 else 'online'
            except:
                pass
    except:
        print(exceptionTraceback())

    return render(
        request, 'avatarFinderApi.html', {
            'users':
            users,
            'showAddButton':
            True if request.user.is_staff
            or request.user.groups.filter(name="Pizza").exists() else False
        })
コード例 #6
0
ファイル: views.py プロジェクト: Phalelashvili/steamboost.ge
def search(request):
    user = request.user
    if not user.is_authenticated:
        return JsonResponse(
            {
                'success':
                False,
                'version':
                avatarFinderVersion,
                'error':
                f'extension-ის გამოსაყენებლად გაიარეთ ავტორიზაცია საიტზე <a href="https://steamboost.ge" target="_blank" style="color: red">steamboost.ge</a>'
            },
            status=400)
    if user.extension_avatarFinder is None:
        return JsonResponse(
            {
                'success':
                False,
                'version':
                avatarFinderVersion,
                'error':
                f'extension ნაყიდი არაა %s-ზე. საყიდლად მოგვწერეთ <a href=\'{DISCORD_INVITE}\' target=\'_blank\' style=\'color: red\'>დისქორდზე</a>'
                % user.username
            },
            status=400)
    if datetime.datetime.now() > user.extension_avatarFinder:
        return JsonResponse(
            {
                'success':
                False,
                'version':
                avatarFinderVersion,
                'error':
                f'ვადა ამოიწურა ({user.extension_avatarFinder}) გასანახლებლად მოგვწერეთ <a href=\'{DISCORD_INVITE}\' target=\'_blank\' style=\'color: red\'>დისქორდზე</a>'
            },
            status=400)
    if GetUserIP(request) != user.ip:
        return JsonResponse(
            {
                'success':
                False,
                'version':
                avatarFinderVersion,
                'error':
                f'თქვენი IP არ ემთხვევა {HideUserIP(user.ip)}-ს. მოგვწერეთ <a href=\'{DISCORD_INVITE}\' target=\'_blank\' style=\'color: red\'>დისქორდზე</a>'
            },
            status=400)

    avatar = request.GET.get('avatar')
    avatarFinder_Log.objects.create(username=user.username,
                                    avatar=avatar,
                                    time=datetime.datetime.now())

    if len(avatar) != 43:
        return JsonResponse({
            'success': False,
            'version': avatarFinderVersion,
            'error': 'ავატარი %s არასწორ ფორმატშია' % avatar
        })

    if avatar == 'fe/fef49e7fa7e1997310d705b2a6158ff8dc1cdfeb' or avatar == 'fb/fb9c36c36e54b8ca5f2e1cbd89c06574d1348af0':
        return JsonResponse(
            {
                'success': False,
                'version': avatarFinderVersion,
                'error': 'default ავატარის მოძებნა შეუძლებელია'
            },
            status=400)

    useSteam = request.GET.get('useSteam')
    #website = 'https://steamcommunity.com/profiles/' if useSteam == 'true' else 'https://steamid.uk/profile/'
    website = 'https://steamcommunity.com/profiles/' if useSteam == 'true' else 'https://steamcommunity.com/profiles/'

    db = list(
        SteamTracker_User.objects.using('steamtracker').filter(
            avatar=avatar).values_list('steam64id', flat=True))
    db = [str(i) for i in db]
    if len(db) == 0:
        return JsonResponse({
            'success': False,
            'error': 'პროფილი არ მოიძებნა',
            'version': avatarFinderVersion
        })
    elif len(db) == 1:
        return JsonResponse({
            'success': True,
            'url': website + db[0],
            'count': len(db),
            'version': avatarFinderVersion
        })
    elif len(db) > 100:
        return JsonResponse({
            'success':
            True,
            'url':
            'https://steamboost.ge/avatar-finder/%s?steam=%s' %
            (avatar, useSteam),
            'count':
            len(db),
            'version':
            avatarFinderVersion
        })
    else:
        possibleProfiles = []
        try:
            count = 0
            while True:
                try:
                    data = requests.get(
                        'https://api.steampowered.com/ISteamUser/GetPlayerSummaries/v2/?key=%s&format=json&steamids=%s'
                        % (API_KEY, ','.join(db))).json()
                    break
                except:
                    count += 1
                if count > 5:
                    return JsonResponse({
                        'success': False,
                        'error': 'დაფიქსირდა შეცდომა',
                        'version': avatarFinderVersion
                    })
            for u in data['response']['players']:
                status = request.GET.get('status')
                if status != '_avatar':
                    if status == 'online' or status == 'offline' or status == 'in-game':
                        personaState = 'offline' if u[
                            'personastate'] == 0 else 'online'
                        if personaState == status:
                            possibleProfiles.append(u['steamid'])

            if len(possibleProfiles) > 1:
                return JsonResponse({
                    'success':
                    True,
                    'url':
                    'https://steamboost.ge/avatar-finder/%s?steam=%s' %
                    (avatar, useSteam),
                    'count':
                    len(db),
                    'version':
                    avatarFinderVersion
                })

            # if len(possibleProfiles) > 1 and len(possibleProfiles) < 5:
            #     base = -1
            #     for u in possibleProfiles:
            #         try:
            #             level = requests.get('https://api.steampowered.com/IPlayerService/GetSteamLevel/v1/?key=%s&steamid=%s'%(API_KEY, u)).json()['response']['player_level']
            #             if level > base:
            #                 base = level
            #             else:
            #                 possibleProfiles.remove(u)
            #         except:
            #             print(exceptionTraceback())
        except:
            print(exceptionTraceback())
            return JsonResponse({
                'success': False,
                'error': 'დაფიქსირდა შეცდომა',
                'version': avatarFinderVersion
            })

    return JsonResponse({
        'success':
        True,
        'url':
        website + possibleProfiles[0] if len(possibleProfiles) > 0 else
        'https://steamboost.ge/avatar-finder/' + avatar,
        'count':
        len(db),
        'version':
        avatarFinderVersion
    })
コード例 #7
0
 def __init__(self):
     self.bots = {}
     self.loginBots()
     while True:
         try:
             for artw in Artwork.objects.filter(favAmount__lte=20):
                 sharedID = artw.sharedID.split('id=')[1]
                 self.artwork(sharedID, artw.favAmount)
                 artw.delete()
         except:
             print(exceptionTraceback())
         print(colored('[Comment Boost] Idle', 'green'))
         try:
             for bot in self.bots.values():
                 # if more than 1 day has passed
                 if datetime.datetime.now() - self.bots[
                         bot.username].time_banned < datetime.timedelta(
                             1, 1, 0):
                     continue
                 try:  # temp solution
                     query = self.get_comment(bot.steam64id)
                 except:
                     sleep(2)
                     continue
                 if query == False:
                     continue
                 try:
                     resp = bot.comment(query['steam64id'],
                                        query['comment'],
                                        proxies={
                                            'https': proxy.getRandom()
                                        },
                                        timeout=15).json()
                 except Exception as err:
                     print(
                         colored(
                             '[Comment Boost] %s | %s %s' %
                             (bot.steam64id, err,
                              ' ' * 10 + '(%s)' % bot.username), 'red'))
                 if resp.get('success', False):
                     print(
                         colored(
                             '[Comment Boost] %s => %s | %s %s' %
                             (bot.steam64id, query['steam64id'],
                              query['comment'],
                              ' ' * 10 + '(%s)' % bot.username), 'green'))
                     db = query['db']
                     db.amount -= 1
                     if db.amount > 0:
                         db.commented += bot.steam64id + ','
                         db.last_comment = datetime.datetime.now()
                         db.save()
                     else:
                         db.delete()
                 else:
                     err = resp.get('error', '')
                     print(
                         colored(
                             '[Comment Boost] %s => %s | %s' %
                             (bot.steam64id, query['steam64id'], err),
                             'red'))
                     if 'posting too frequently' in err:
                         self.bots[
                             bot.
                             username].time_banned = datetime.datetime.now(
                             )
                         print(
                             colored(
                                 '[Comment Boost] %s got banned' %
                                 bot.steam64id, 'cyan'))
                     # elif 'The settings on this account do not allow you to add comments' in err:
                     #     db = query['db']
                     #     if db.amount == 6:
                     #         user = User.objects.get(username=db.steam64id)
                     #         user.freeCommentAvailable = True
                     #         user.save()
                     #         notify(db, 'კომენტარები არის private, შეცვალეთ და ახლიდან ჩართეთ ბუსტი')
                     #         db.delete()
             sleep(10)
         except KeyboardInterrupt:
             print(colored('logging out of bots', 'yellow'))
             threads = []
             try:
                 for bot in self.bots.values():
                     threads.append(
                         Thread(target=bot.logout),
                         kwargs={'proxies': {
                             'https': proxy.getRandom()
                         }})
                 for t in threads:
                     t.start()
                 for t in threads:
                     t.join()
             except:
                 pass
             collect()
             print(colored('collected garbage, exiting...', 'yellow'))
             sys.exit(0)
         if os.path.isfile('debugc'):
             os.remove('debugc')
             while True:
                 try:
                     command = input(colored('[Debug]: ', 'yellow'))
                     if command != 'cont' and command != 'continue':
                         exec(command)
                     else:
                         print(colored('[Debug] Exiting...', 'yellow'))
                         break
                 except:
                     print(colored(exceptionTraceback(), 'yellow'))
コード例 #8
0
ファイル: views.py プロジェクト: Phalelashvili/steamboost.ge
def PizzaNotifier():
    # if other gunicorn worker has already started notifier`
    if redis.get('pizzaNotifierStarted') == b'True':
        return
    redis.set('pizzaNotifierStarted', 'True')

    Thread(target=updateSteamStatus, daemon=True).start()

    last = Pizza.objects.using('pizza').filter(
        ~Q(avatar='', scanned=False)).latest('id')
    while True:
        try:
            new = Pizza.objects.using('pizza').filter(
                ~Q(avatar='', scanned=False)).latest('id')
            if last.id != new.id:
                if len(new.avatar.split(';')) > 2:
                    last = new
                    continue
                profiles = SteamTracker_User.objects.using(
                    'steamtracker').filter(avatar=new.avatar[:-1])
                if new.avatar == 'fe/fef49e7fa7e1997310d705b2a6158ff8dc1cdfeb' or new.avatar == 'fb/fb9c36c36e54b8ca5f2e1cbd89c06574d1348af0':
                    last = new
                    continue
                try:
                    '''
                    calling len() on queryset executes count() in sql, which takes too long in 600mil+ database
                    couldn't find other way to check if list has 100 items without calling len or this
                    '''
                    profiles[100]
                    length = limit
                except:
                    length = len(profiles)

                if length == 0 or length > 30:
                    last = new
                    continue

                name = urllib.parse.unquote(new.item).split('/')[6]
                shortName = name\
                    .replace("★ ", "")\
                    .replace("StatTrak™", "ST")\
                    .replace("Factory New", "FN")\
                    .replace("Minimal Wear", "MW")\
                    .replace("Field-Tested ", "FT")\
                    .replace("Well-Worn", "WW")\
                    .replace("Battle-Scarred", "BS")
                details = []

                if len(profiles) == 1:
                    try:
                        with open('proxylist') as f:
                            proxy = {'https': f.read()}
                    except:
                        proxy = None

                    html = requests.get(
                        'https://steamid.uk/profile/%s' %
                        profiles[0].steam64id,
                        proxies=proxy,
                        headers={
                            "User-Agent":
                            "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:70.0) Gecko/20100101 Firefox/70.0"
                        }).content.decode('unicode_escape')
                    soup = BeautifulSoup(html, 'html.parser')
                    panel = soup.find_all('div', {'class': 'panel-body'})[1]

                    # so i can just split .text later
                    for br in panel.find_all('br'):
                        br.replace_with('\r\n')

                    for div in panel.find_all(
                            'div'):  # filter out useless info
                        div.decompose()

                    for line in panel.text.split('\r\n')[:-3]:
                        stat = BeautifulSoup(line, 'html.parser').text.replace(
                            '\n', '')
                        if '|' not in stat:
                            stat = stat.replace('\n', '').replace('  ', ' ')
                            if len(stat) == 0:
                                continue
                            while (stat[0] == ' '):
                                stat = stat[1:]
                            details.append(stat)

                    # Thread(target=spamHits, args=(profiles[0].steam64id, new), daemon=True).start()
                    # Thread(target=burritoScan, args=(profiles[0].steam64id,), daemon=True).start()

                updated = None
                try:
                    updated = int(''.join(filter(str.isdigit, details[-1])))
                except:
                    pass
                details = "\r\n".join(details)
                if details == '':
                    details is None
                new.refresh_from_db()
                new.details = details
                new.save()

                if not updated or updated < 30:
                    for user in User.objects.filter(groups__name='Pizza'):
                        if len(profiles) == 1:
                            url = 'https://steamid.uk/profile/' + \
                                str(profiles[0].steam64id)
                        else:
                            url = 'https://steamboost.ge/pizza'
                        notify(user,
                               msg='%s\nPrice: %s\n' % (shortName, new.price) +
                               details,
                               url=url,
                               ttl=60,
                               log=False)
        # except django.db.utils.InterfaceError:
        #    while True:
        #        try:
        #            print("[Database] Connecting")
        #            connection.connect()
        #            print("[Database] Connected")
        #            break
        #        except Exception as e:
        #            print(e)
        #            pass
        #        sleep(10)
        except:
            print('pizza exception')
            print(exceptionTraceback())
        last = new

        sleep(3)
コード例 #9
0
def boost(request, action):
    user = request.user
    if request.method != 'POST':
        raise Http404
    if user.gems > 0 and not user.is_staff:
        if request.LANGUAGE_CODE == 'ka':
            return HttpResponse('ბუსტის ჩართვამდე საჭიროა დარჩენილი %s Gem-ის დაბრუნება (მთავარი გვერდიდან)' % user.gems)
        else:
            return HttpResponse('You need to return %s gem (from main page) before starting boost' % user.gems)
    try:
        if action == 'hour':
            if not is_running('HourBoost.py'):
                return HttpResponse('ბუსტი ჩართული არაა')

            if not WebSettings.hboost_enabled and not request.user.is_staff:
                return HttpResponse('ბუსტი დროებით გათიშულია' if request.LANGUAGE_CODE == 'ka' else 'boost temporarily disabled')
            form = h_boost_form(request.POST)
            if not form.is_valid():
                return HttpResponse('მონაცემები არასწორია' if request.LANGUAGE_CODE == 'ka' else 'Invalid input', status=400)
            time = str(datetime.datetime.now())
            username = form.cleaned_data['steam_username'].replace(
                ' ', '').lower()
            if Hour_queue.objects.filter(username=username).exists():
                return HttpResponse('ბუსტი უკვე ჩართულია' if request.LANGUAGE_CODE == 'ka' else 'boost is already started', status=202)
            if Trade_queue.objects.filter(username=username, stopped=False).exists():
                return HttpResponse('დაელოდეთ Trade ბუსტის დასრულებას ან გამორთეთ' if request.LANGUAGE_CODE == 'ka' else 'Trade boost already started, wait until it\'s finished or cancel it', status=202)
            password = form.cleaned_data['steam_password']
            authcode = form.cleaned_data['auth_code']
            boost_time = form.cleaned_data['boost_time']
            games = form.cleaned_data['games_id']
            free = form.cleaned_data['free']
            try:
                for x in games.split('-'):
                    int(x)  # raises error if x is string
                if len(games.split('-')) > 30:
                    return HttpResponse('თამაშების სია 30-ზე მეტია' if request.LANGUAGE_CODE == 'ka' else 'you can\'t boost more than 30 games at the same time')
            except:
                return HttpResponse('თამაშების სია არასწორია')
            total_price = WebSettings.h_boost_price * boost_time
            if user.credits >= total_price or user.is_superuser or free:
                if not user.is_superuser:
                    if not free:
                        user.credits -= round(total_price, 2)
                        user.save()
                link = Hour_queue.objects.create(user=user.username, username=username, password=encode(
                    BOOST_ENCRYPTION_KEY, password), authcode=encode(BOOST_ENCRYPTION_KEY, authcode), target_time=boost_time, games=games, free=free)
                Logs.objects.create(user=user, type='hour_boost', time=time, details=f'{username} | {boost_time} | {games}', change=-total_price, link=link.id)
                return HttpResponse("ბუსტი ჩაირთო" if request.LANGUAGE_CODE == 'ka' else 'boost started')
            else:
                return HttpResponse("თქვენ არ გაქვთ საკმარისი თანხა" if request.LANGUAGE_CODE == 'ka' else 'insufficient funds')
        elif action == 'comment':
            if not WebSettings.cboost_enabled and not request.user.is_staff:
                return HttpResponse('ბუსტი დროებით გათიშულია' if request.LANGUAGE_CODE == 'ka' else 'boost temporarily disabled')
            form = c_boost_form(request.POST)
            if not form.is_valid():
                return HttpResponse('მონაცემები არასწორია' if request.LANGUAGE_CODE == 'ka' else 'Invalid input', status=400)
            amount = form.cleaned_data['comment_amount']
            time = datetime.datetime.now()
            if amount == 6:
                free = True
                if not user.freeCommentAvailable:
                    return HttpResponseRedirect(REDIRECT_URL)
            else:
                free = False
                amount = round(amount, -2)
                if amount == 0:
                    return HttpResponse('რაოდენობა არასწორია' if request.LANGUAGE_CODE == 'ka' else 'Invalid amount')
            delay = form.cleaned_data['delay']
            if delay == '' or delay is None:
                delay = 0
            comment = form.cleaned_data['comment']
            if comment == '' or comment is None:
                comment = None
            steam64id = user.username
            if Comment_queue.objects.filter(steam64id=steam64id).exists():
                return HttpResponse('ბუსტი უკვე ჩართულია' if request.LANGUAGE_CODE == 'ka' else 'Boost already started', status=202)
            total_price = round(amount, -2) * (WebSettings.c_boost_price / 100)
            if user.balance >= total_price or user.is_superuser or free:
                if not user.is_superuser and not free:
                    user.balance -= round(total_price, 2)
                if free:
                    user.freeCommentAvailable = False
                req = requests.get(
                    'https://api.steampowered.com/ISteamUser/GetPlayerSummaries/v2/?key=%s&format=json&steamids=%s' % (apiKey, user.username)).json()
                if not 'commentpermission' in req['response']['players'][0] or not req['response']['players'][0]['commentpermission']:
                    return HttpResponse('თქვენი პროფილი არის private, შეცვალეთ და ახლიდან ჩართეთ ბუსტი')
                user.save()
                db = Comment_queue.objects.create(
                    steam64id=steam64id, delay=delay, comment=comment, amount=amount, time=time, commented='', returned='')
                Logs.objects.create(user=user, type='comment_boost', time=time, details='%s(%s)' % (
                    comment, amount), change=-total_price)
                if not free:
                    commentList = 'https://steamboost.ge/commentlist' if db.comment is None else 'wait for custom list in discord'
                    msg = 'https://steamcommunity.com/profiles/%s (%s)' % (
                        db.steam64id, commentList)
                    amount_of_keys = int(amount/100)
                    Thread(target=send_keys_to_dealer,
                           args=(amount_of_keys, msg)).start()
                return HttpResponse("ბუსტი დაიწყება უახლოეს 24 საათში" if request.LANGUAGE_CODE == 'ka' else 'Boost may take up to 24 hours')
            else:
                return HttpResponse("თქვენ არ გაქვთ საკმარისი თანხა")
        elif action == 'trade':
            if not is_running('TradeBoost.py'):
                return HttpResponse('ბუსტი ჩართული არაა')
            if not WebSettings.tboost_enabled and not request.user.is_staff:
                return HttpResponse('ბუსტი დროებით გათიშულია' if request.LANGUAGE_CODE == 'ka' else 'boost temporarily disabled')

            form = t_boost_form(request.POST)
            if not form.is_valid():
                return HttpResponse('მონაცემები არასწორია ან ბუსტი ნაკლებია/მეტია მინიმუმზე/მაქსიმუმზე', status=202)
            username = form.cleaned_data['steam_username'].replace(
                ' ', '').lower()
            if Trade_queue.objects.filter(username=username).exists():
                return HttpResponse("ბუსტი უკვე ჩართულია" if request.LANGUAGE_CODE == 'ka' else 'Boost already started', status=202)
            if Hour_queue.objects.filter(username=username, stopped=False).exists():
                return HttpResponse('დაელოდეთ hour ბუსტის დასრულებას ან გამორთეთ' if request.LANGUAGE_CODE == 'ka' else 'wait until hour boost is finished or cancel it', status=202)
            password = form.cleaned_data['steam_password']
            authcode = form.cleaned_data['authcode'].replace(' ', '')
            identity_secret = form.cleaned_data['identity_secret'].replace(
                ' ', '')
            shared_secret = form.cleaned_data['shared_secret'].replace(' ', '')
            trade_amount = form.cleaned_data['trade_amount']
            free = False
            if trade_amount == 250:
                if user.freeTradeAvailable:
                    if not check_lvl(user.username):
                        return HttpResponse('ფეიკ აქაუნთების თავიდან ასაცილებლად საჭიროა სტიმზე გქონდეთ 6 ლეველზე მეტი' if request.LANGUAGE_CODE == 'ka' else 'you need to be at least 6 level to use free boost')
                    user.freeTradeAvailable = False
                    free = True
                else:
                    return HttpResponse('უფასო 250 უკვე გამოყენებულია')
            else:
                if trade_amount < 1000:
                    return HttpResponse('მინიმუმი 1000 თრეიდია' if request.LANGUAGE_CODE == 'ka' else 'Minimum amount is 1000')
            total_price = WebSettings.t_boost_price * (trade_amount / 1000)
            if trade_amount >= 10000:  # if more than 10k, calculate discount
                discount = (trade_amount // 10000) * 10
                total_price -= (discount * ((trade_amount / 1000)
                                            * WebSettings.t_boost_price)) / 100
            if not user.is_superuser and not free and user.balance < total_price and user.credits < total_price:
                return HttpResponse("თქვენ არ გაქვთ საკმარისი თანხა" if request.LANGUAGE_CODE == 'ka' else 'insufficient funds')
            if not free and not user.is_superuser:
                if user.credits >= total_price:
                    user.credits -= round(total_price, 2)
                else:
                    user.balance -= round(total_price, 2)
            if authcode == '':
                link = Trade_queue.objects.create(user=user.username, username=username, password=encode(BOOST_ENCRYPTION_KEY, password), shared_secret=encode(
                    BOOST_ENCRYPTION_KEY, shared_secret), identity_secret=encode(BOOST_ENCRYPTION_KEY, identity_secret), amount=trade_amount, one_way_trade=False)
            else:
                link = Trade_queue.objects.create(user=user.username, username=username, password=encode(
                    BOOST_ENCRYPTION_KEY, password), authcode=encode(BOOST_ENCRYPTION_KEY, authcode), amount=trade_amount, one_way_trade=True)
                if not free:
                    user.gems += trade_amount
            user.save()
            Logs.objects.create(user=user.username, type='trade_boost', time=datetime.datetime.now(
            ), details='%s - %s' % (username, trade_amount), change=-total_price if not free else 0, link=link.id)
            message = 'ბუსტი ჩაირთო, ' if request.LANGUAGE_CODE == 'ka' else 'boost started, '
            if free or authcode == '':
                message += 'ამ შემთხვევაში gem-ების დაბრუნება საჭირო არაა' if request.LANGUAGE_CODE == 'ka' else 'no need to return gems for free boost'
            else:
                if request.LANGUAGE_CODE == 'ka':
                    message += 'დასრულების შემდეგ დააბრუნეთ %s gem მთავარი გვერდიდან' % trade_amount
                else:
                    message += 'return %s gem from main page after completing boost' % trade_amount
            return HttpResponse(message)
        elif action == 'artwork':
            if not WebSettings.aboost_enabled and not request.user.is_staff:
                return HttpResponse('ბუსტი დროებით გათიშულია' if request.LANGUAGE_CODE == 'ka' else 'boost temporarily disabled')
            form = a_boost_form(request.POST)
            if not form.is_valid():
                return HttpResponse('მონაცემები არასწორია' if request.LANGUAGE_CODE == 'ka' else 'Invalid input', status=400)
            link = form.cleaned_data['sharedID']
            if Artwork.objects.filter(sharedID=link).exists():
                return HttpResponse('ბუსტი უკვე ჩართულია' if request.LANGUAGE_CODE == 'ka' else 'Boost already started')
            try:
                sharedID = int(link.split('id=')[1])
            except:
                return HttpResponse('არტვორკის ლინკი არასწორია' if request.LANGUAGE_CODE == 'ka' else 'invalid artwork link')
            likeAmount = form.cleaned_data['likeAmount']
            favAmount = form.cleaned_data['favAmount']
            if likeAmount == 10 and favAmount == 10:
                free = True
                if not user.freeArtworkAvailable:
                    return HttpResponseRedirect(REDIRECT_URL)
            else:
                free = False
                likeAmount = 250 * round(likeAmount/250)
                favAmount = 250 * round(favAmount/250)
            total_price = (round(favAmount/250) +
                           round(likeAmount/250)) * WebSettings.a_boost_price
            time = datetime.datetime.now()
            if user.balance < total_price and not user.is_superuser and not free:
                return HttpResponse("თქვენ არ გაქვთ საკმარისი თანხა" if request.LANGUAGE_CODE == 'ka' else 'insufficient funds')
            if not user.is_superuser and not free:
                user.balance -= round(total_price, 2)
            if free:
                user.freeArtworkAvailable = False
            user.save()
            Artwork.objects.create(
                user=user.username, sharedID=link, likeAmount=likeAmount, favAmount=favAmount)
            Logs.objects.create(user=user, type='artwork_boost', time=time, details='%s (%s | %s)' % (
                sharedID, likeAmount, favAmount), change=-total_price)
            if not free:
                msg = 'https://steamcommunity.com/sharedfiles/filedetails/?id=%s (like - %s | fav - %s)' % (
                    sharedID, likeAmount, favAmount)
                keys = int(total_price/WebSettings.a_boost_price)
                Thread(target=send_keys_to_dealer, args=(keys, msg)).start()
            return HttpResponse("ბუსტი დაიწყება უახლოეს 24 საათში" if request.LANGUAGE_CODE == 'ka' else 'Boost may take up to 24 hours')
        else:
            return HttpResponseRedirect('/boost')
    except:
        Notifications.objects.create(to=user.username, sender='System', time=datetime.datetime.now(), message=f'დაფიქსირდა შეცდომა, დაგვიკავშირდით <a href="{DISCORD_INVITE}" target="_blank" style="color: red">დისქორდზე</a>', cause=str(exceptionTraceback()))
        return HttpResponse(f'დაფიქსირდა შეცდომა, დაგვიკავშირდით <a href="{DISCORD_INVITE}" target="_blank" style="color: red">დისქორდზე</a> (500)', status=500)