Skip to content
This repository was archived by the owner on Feb 3, 2024. It is now read-only.

Commit e172608

Browse files
committed
1.3.3.6 General Drops Fix
- Added some WaitForSelectors to prevent getting data not loaded yet - Added some more Debug lines. - Added SkipUserDataPathQuestion option to settings. (DELETE old settings file for this to work) - Added a Check for the case that all channels are Claimed - Fixed twitch moving everything to General Drops breaking the bot - Fixed 'Invalid parameters Failed to deserialize params.url' caused when only one claimed channel is being online. - Fixed SamePercentCheck causing it to break after some tries. - Removed unicode symbols
1 parent 8baeaed commit e172608

18 files changed

Lines changed: 153 additions & 28 deletions

README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@
4848
<li><a href="#displayless">Displayless</a></li>
4949
<li><a href="#checkclaimedonstart">CheckClaimedOnStart</a></li>
5050
<li><a href="#skiploginpage">SkipLoginPage</a></li>
51+
<li><a href="#skipuserdatapathquestion ">SkipUserDataPathQuestion </a></li>
5152
<li><a href="#progresscheckinterval">ProgressCheckInterval</a></li>
5253
<li><a href="#auto-claim">AutoClaim</a></li>
5354
<li><a href="#logtofile">LogToFile</a></li>
@@ -248,6 +249,9 @@ Example CustomChannels File:
248249
### SkipLoginPage
249250
- Option to skip the LoginPage and prevent it from always opening on start. Only use if twitch-session.jso (cookies) are provided.
250251

252+
### SkipUserDataPathQuestion
253+
- Option to skip the UserDataPathQuestion and prevent it from always opening when not providing one.
254+
251255
### ProgressCheckInterval
252256
- Option to change the Progress Interval in ms. Default is `60000` which is every `60` seconds the bot will check the progress. Can be increased for slow internet connections to prevent the bot from retrying so often.
253257

TTVDropBot-linux-x64

40.3 KB
Binary file not shown.

TTVDropBot.exe

40.4 KB
Binary file not shown.

package-lock.json

Lines changed: 13 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "ttvdropbot",
3-
"version": "1.3.3-dev",
3+
"version": "1.3.3-main",
44
"description": "Twitch Drop Bot",
55
"main": "src/index.js",
66
"scripts": {
@@ -18,6 +18,7 @@
1818
"puppeteer-core": "^13.1.3",
1919
"puppeteer-extra": "^3.1.16",
2020
"puppeteer-extra-plugin-stealth": "^2.7.4",
21+
"similarity": "^1.2.1",
2122
"wait-console-input": "^0.1.7",
2223
"winston": "^3.5.1"
2324
},
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
const data = require("../Data/SavedData")
2+
3+
async function AllChannelsClaimedCheck() {
4+
let chsclaimed = 0;
5+
6+
data.Streamers.forEach((element, index) => {
7+
if (element.claimed) {
8+
chsclaimed++
9+
}
10+
})
11+
return chsclaimed === data.Streamers.length
12+
}
13+
14+
module.exports = {
15+
AllChannelsClaimedCheck
16+
}

src/Checks/CheckProgressCurrentPage.js

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ const {MapDrops} = require("../functions/MapDrops");
22
const {GetRustDrops} = require("../functions/GetRustDrops");
33
const data = require("../Data/SavedData");
44
const {ciEquals} = require("../functions/util");
5+
const {Rustdrops_twitch} = require("../Data/SavedData");
56

67
async function CheckProgressCurrentPage(page, dropspage, startch, campaignpage) {
78

@@ -16,14 +17,25 @@ async function CheckProgressCurrentPage(page, dropspage, startch, campaignpage)
1617
}
1718
})
1819

19-
for (let i = 0; i < data.dropsmap.length; i++)
20-
{
21-
if (data.claimed.includes(name)) {
22-
return -1
23-
} else if (ciEquals(data.dropsmap[i].url, startch)) {
24-
return data.dropsmap[i].percentage
20+
let progressarray = [];
21+
async function handleprogress() {
22+
for (let i = 0; i < data.dropsmap.length; i++)
23+
{
24+
if (data.alldropsgeneral) {
25+
data.Rustdrops_twitch.forEach(e => {
26+
if (e.drop.toLowerCase() === data.dropsmap[i].name.toLowerCase()) {
27+
progressarray.push({name: data.dropsmap[i].name, percentage: data.dropsmap[i].percentage})
28+
}
29+
})
30+
} else if (data.claimed.includes(name)) {
31+
return -1
32+
} else if (ciEquals(data.dropsmap[i].url, startch)) {
33+
return data.dropsmap[i].percentage
34+
}
2535
}
36+
return progressarray;
2637
}
38+
return await handleprogress();
2739
}
2840

2941
module.exports = {

src/Checks/CheckifAllClaimed.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ async function CheckifAllClaimed() {
99
alreadyclaimedandonline++
1010
}
1111
})
12-
return alreadyclaimedandonline === data.choi.length
12+
return (data.alldropsgeneral) ? false : alreadyclaimedandonline === data.choi.length
1313
}
1414

1515
module.exports = {

src/Data/SavedData.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ let Rustdrops_twitch = undefined
1414
let choi = [];
1515
let offlinechs = [];
1616
let dropsmap = [];
17-
17+
let alldropsgeneral = false;
1818
//starting ch
1919
let Startingchannel;
2020

@@ -38,6 +38,7 @@ let headless = true;
3838

3939
module.exports = {
4040
settings,
41+
alldropsgeneral,
4142
debug,
4243
Rustdrops_twitch,
4344
headless,

src/Pages/StreamCustomPage.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,7 @@ async function farmpoint(page) {
181181
//Inject JQuery
182182
await page.addScriptTag({url: 'https://code.jquery.com/jquery-3.6.0.js'})
183183
if (data.debug) winston.info(chalk.gray("Waiting for WatchingPage to load (WaitForSelector)"));
184-
await page.waitForSelector('[data-test-selector="balance-string"]', {visible: true});
184+
try {await page.waitForSelector('[data-test-selector="balance-string"]', {visible: true});} catch (e) {winston.info(chalk.yellow('WARNING: Points Balance not loaded...'))}
185185
return await page.evaluate(() => {
186186
let rawPoints = $('[data-test-selector="balance-string"]').text()
187187
let communitybuttons = $('[data-test-selector="community-points-summary"]').find("button")

0 commit comments

Comments
 (0)