Skip to content

Commit

Permalink
aight it do be owrking like that
Browse files Browse the repository at this point in the history
  • Loading branch information
viktorashi committed Jan 18, 2025
1 parent e9bd656 commit 8a52764
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 34 deletions.
51 changes: 27 additions & 24 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,32 @@ copy and paste this block into your terminal
```bash
git clone https://github.com/viktorashi/bingobaker.com-autoplayer && cd bingobaker.com-autoplayer && pip install -r requirements.txt
```
<h3>2. Get usage directions</h3>
<h3>2. Usage example</h3>

#### Don't be scared by the extensive docs, it's actually really easy to use
First you would usually want to generate the cards, so
##### **`zsh`**
```bash
python autobingo.py generate --url https://bingobaker.com/#64c998520e68afc5 -cnt 100
```
should do the job, then you would create an **input.txt** right next to this and run

##### **`zsh`**
```bash
python autobingo.py check
```
This will copy "!bingowin #\<number\>" to your clipboard automatically for each bingo found
ez, see if it outputed anything about a congratilations, then go to output.json to check it.
#### This generates 75 bingo cards with the generator link you have provided to it, the bingo's of which will be saved to the ***wins.txt*** file.

##### **`zsh`**
```bash
python autobingo.py generate --url https://bingobaker.com/#64c998520e68afc5 --output wins.txt --count 75
```
Given all this data has been saved to ***bingoconfig.json*** this


<h3>3. Get usage directions</h3>


```bash
Expand Down Expand Up @@ -60,6 +84,8 @@ ion care how u use my code lol
```
for the operation and options



## Regarding all the options : if nothing is specified, the last used value from the bingoconfig.json file will be used, if never specified before, the default values will be used

### <font size=5> Positional arguments</font> refer to the first thing you type after ```python autobingo.py```, meaning the function you want to execute, generating, checking the bingos, marking the spots (which includes checking the bingo's if any spots containing the keywords have been found), and clearing the cards in case jack got a bigo already :'(
Expand Down Expand Up @@ -166,29 +192,6 @@ idk how well i've tested this but i believe it starts messing up if you do. But

Also, if you've checked the same card twice, even if you changed the gamemode, it won't auto-mark the spots again, even if the checked spots are different.

<h1>Usage example</h1>

#### Don't be scared by the extensive docs, it's actually really easy to use
First you would usually want to generate the cards, so
##### **`zsh`**
```bash
python autobingo.py generate --url https://bingobaker.com/#64c998520e68afc5 -cnt 100
```
should do the job, then you would create an **input.txt** right next to this and run

##### **`zsh`**
```bash
python autobingo.py check
```
ez, peek into the console once in a while and see if it outputed anything about a congratilations, then go to output.json to check it.
#### This generates 75 bingo cards with the generator link you have provided to it, the bingo's of which will be saved to the ***wins.txt*** file.

##### **`zsh`**
```bash
python autobingo.py generate --url https://bingobaker.com/#64c998520e68afc5 --output wins.txt --count 75
```
Given all this data has been saved to ***bingoconfig.json*** this


<h2>For the coders</h2>
There's also a class you can use in your projects by doing
Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ certifi==2023.7.22
charset-normalizer==3.2.0
idna==3.4
numpy==1.26.0
pyperclip==1.9.0
requests==2.31.0
soupsieve==2.5
tk==0.1.0
urllib3==2.0.4
websockets==11.0.3
14 changes: 5 additions & 9 deletions utils.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import requests, re
from time import sleep
from math import ceil
import tkinter as tk
import pyperclip


def get_text_squares(self, squares) -> [[str]]:
Expand Down Expand Up @@ -261,9 +261,6 @@ def check_bingos_and_write_to_output(self) -> None:
global lock
import threading
lock = threading.Lock()
r = tk()
r.withdraw()
r.clipboard_clear()
# but only if there are more cards than threads, cuz otherwise don't work
if leng >= self.num_of_threads:
cards_chunks = [
Expand All @@ -275,7 +272,7 @@ def check_bingos_and_write_to_output(self) -> None:

for chunk in cards_chunks:
t = threading.Thread(
target=check_part_of_cards, args=(self, chunk, check_bingo, winning_cards, r)
target=check_part_of_cards, args=(self, chunk, check_bingo, winning_cards)
)
# t.daemon = True
threads.append(t)
Expand All @@ -286,7 +283,7 @@ def check_bingos_and_write_to_output(self) -> None:
for thread in threads:
thread.join()
else:
check_part_of_cards(self, self.cards, check_bingo, winning_cards, r)
check_part_of_cards(self, self.cards, check_bingo, winning_cards)

if len(winning_cards) > 0:
previous_wins = read_from_output(self)
Expand Down Expand Up @@ -315,7 +312,7 @@ def check_bingos_and_write_to_output(self) -> None:


def check_part_of_cards(
self, cards: [dict], check_bingo_function, winning_cards, tkinter_clipboard
self, cards: [dict], check_bingo_function, winning_cards
) -> [dict]:
for card in cards:
# the following will add new attribute to card dict
Expand All @@ -328,8 +325,7 @@ def check_part_of_cards(
# last 6 charracters of the link
card["key"] = f'!bingowin #{card["url"][-6:]}'

tkinter_clipboard.clipboard_append(card["key"])
tkinter_clipboard.update() # this keeps it after it closes apparently
pyperclip.copy(card["key"])

print("https://bingobaker.com/play/" + card["url"])
print(card["key"])
Expand Down

0 comments on commit 8a52764

Please sign in to comment.