Skip to content
This repository was archived by the owner on Jan 6, 2022. It is now read-only.

Commit a21384b

Browse files
author
ToasterUwU
committed
1.3
1 parent f1dec2e commit a21384b

File tree

5 files changed

+51
-7
lines changed

5 files changed

+51
-7
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,7 @@ If you need any help with using Anti-Scalp, join the [discord server](https://di
144144
- [X] ~~Save settings~~
145145
- [ ] Auto accept cookies to fix "Auto add to cart" on some websites
146146
- [ ] Tutorial video for the ones that are not so good with tech
147+
- [X] ~~Discord Presence to show of with Anti-Scalp :P~~
147148
- [X] ~~Only notify under specific price (Will sort out moon prices)~~
148149
- [ ] Average price checker
149150
- [ ] Price history checker

anti-scalp.pyw

Lines changed: 49 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import datetime
12
import functools
23
import getpass
34
import hashlib
@@ -21,6 +22,7 @@ from typing import Callable, Iterable
2122

2223
import lxml.html
2324
import playsound
25+
import pypresence
2426
import requests
2527
from darktheme.widget_template import DarkPalette
2628
from discord import Embed, Webhook
@@ -35,7 +37,7 @@ from PyQt5.QtWidgets import (QApplication, QCheckBox, QFileDialog, QFrame,
3537
from selenium import webdriver
3638
from tldextract import extract as url_parse
3739

38-
VERSION = "1.2"
40+
VERSION = "1.3"
3941

4042
logging.basicConfig(
4143
level=logging.INFO,
@@ -132,6 +134,8 @@ class utility():
132134
for old, new in pairs.items():
133135
price = price.replace(old, new)
134136

137+
price = price.replace(".", "", (price.count(".")-1))
138+
135139
if " " in price:
136140
chunks = price.split(" ")
137141
for chunk in chunks:
@@ -360,8 +364,8 @@ class Selenium_Checker(Checker):
360364

361365
if data_dict["buyable"]:
362366
self.return_func(data_dict, p)
363-
364-
logging.info(f"OUT OF STOCK -> {p} ({data_dict['link']}) -> {data_dict['price']}")
367+
else:
368+
logging.info(f"OUT OF STOCK -> {p} ({data_dict['link']}) -> {data_dict['price']}")
365369

366370
else:
367371
links.remove(link)
@@ -669,6 +673,14 @@ class GUI():
669673
except:
670674
pass
671675

676+
self.presence = pypresence.Presence(client_id="833460064303972373")
677+
try:
678+
self.presence.connect()
679+
except Exception as e:
680+
logging.error(str(e))
681+
682+
self.update_presence()
683+
672684
self.getter = Link_Getter()
673685

674686
self.result_browser = Broswer(headless=False)
@@ -963,6 +975,8 @@ class GUI():
963975
self.req_checker.stop()
964976
self.sel_checker.stop()
965977

978+
self.update_presence(details=f"Found a {p}", state=f"for {data_dict['price']}", small_image="pause", small_text="Paused")
979+
966980
try:
967981
self.result_browser.add_to_cart(data_dict["link"])
968982
except:
@@ -974,9 +988,9 @@ class GUI():
974988
# Claiming this software as yours is illegal and will be prosecuted. Changing any of the text in the embed also counts as changing the code.
975989
# (Execptions can be made if you have a agreement with me: ToasterUwU)
976990

977-
embed = Embed(title=data_dict['title'], description=f"Found {p} for {data_dict['result']}\n\n{data_dict['link']}", color=0xadff2f)
978-
embed.add_field(name="Send by Anti-Scalp", value="Anti Scalp is a Stock-Checker, made for everyone and free. To get much faster access to the stock alerts, download it and use it yourself. (No worries, it has a graphical interface. Like i said: Made for everyone)\n\nhttps://github.com/ToasterUwU/Anti-Scalp", inline=False)
979-
embed.add_field(name="Copyright", value="This Software is made by ToasterUwU. Claiming it as yours is illegal and will be prosecuted.", inline=False)
991+
embed = Embed(title=data_dict['title'], description=f"Found {p} for {data_dict['price']}\n\n{data_dict['link']}", color=0xadff2f)
992+
embed.add_field(name="Sent by Anti-Scalp", value="Anti Scalp is a Stock-Checker, made for everyone and free. To get much faster access to the stock alerts, download it and use it yourself. (No worries, it has a graphical interface. Like I said: Made for everyone)\n\nhttps://github.com/ToasterUwU/Anti-Scalp", inline=False)
993+
embed.add_field(name="Copyright", value="This software is made by ToasterUwU. Claiming it as yours is illegal and will be prosecuted.", inline=False)
980994

981995
webhook = Webhook.from_url(webhook_url, adapter=RequestsWebhookAdapter())
982996
try:
@@ -1019,13 +1033,34 @@ class GUI():
10191033
with open(PATH+"links/max-prices.json", "w") as f:
10201034
json.dump(max_prices, f, indent=4)
10211035

1036+
def update_presence(self, **kwargs):
1037+
standard = {
1038+
"state": "Paused",
1039+
"small_image": "pause",
1040+
"small_text": "Paused",
1041+
"large_image": "anti-scalp",
1042+
"buttons": [
1043+
{"label": "Download", "url": "https://github.com/ToasterUwU/Anti-Scalp"},
1044+
{"label": "Infos and Support", "url": "https://discord.gg/76ZAefBcC4"}
1045+
]
1046+
}
1047+
1048+
standard.update(kwargs)
1049+
1050+
try:
1051+
self.presence.update(**standard)
1052+
except Exception as e:
1053+
logging.error(str(e))
1054+
10221055
def btn_function(self):
10231056
if self.start_stop_btn.text() == "Stop":
10241057
self.start_stop_btn.setText("Start")
10251058

10261059
self.req_checker.stop()
10271060
self.sel_checker.stop()
10281061

1062+
self.update_presence()
1063+
10291064
else:
10301065
if self.getter.regions == []:
10311066
msg = QMessageBox()
@@ -1045,6 +1080,14 @@ class GUI():
10451080

10461081
self.start_stop_btn.setText("Stop")
10471082

1083+
regions = len(self.getter.regions)
1084+
products = len(self.getter.products)
1085+
links = len(self.getter.get_requests_links())
1086+
if self.setting_use_selenium.isChecked():
1087+
links += len(self.getter.get_selenium_links())
1088+
1089+
self.update_presence(details=f"{regions} Regions - {products} Products", state=f"{links} Links", small_image="play", small_text="Running")
1090+
10481091
self.req_checker = Request_Checker(self.getter.get_requests_links(), return_func=gui.alert, logging_func=gui.log, links_per_instance=self.setting_links_per_r.value())
10491092
self.req_checker.start()
10501093

icon.ico

-219 KB
Binary file not shown.

installer-conf.iss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
; SEE THE DOCUMENTATION FOR DETAILS ON CREATING INNO SETUP SCRIPT FILES!
33

44
#define MyAppName "Anti-Scalp"
5-
#define MyAppVersion "1.2"
5+
#define MyAppVersion "1.3"
66
#define MyAppPublisher "ToasterUwU"
77
#define MyAppURL "https://github.com/ToasterUwU/Anti-Scalp"
88
#define MyAppExeName "anti-scalp.exe"

requirements.txt

24 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)