5 Commits

Author SHA1 Message Date
fa8bdc0e1f ignoring .vscode now 2022-12-15 12:05:22 +01:00
b9a7d85674 Improved requirements 2022-12-15 12:05:14 +01:00
fe1c6984b2 Option to use compiled page saver 2022-09-08 13:04:37 +02:00
e7ef1d4613 Added encoding header 2022-09-08 12:54:43 +02:00
85a756dcab Added license badge 2022-09-08 12:54:13 +02:00
6 changed files with 17 additions and 4 deletions

1
.gitignore vendored
View File

@@ -152,3 +152,4 @@ cython_debug/
# option (not recommended) you can uncomment the following to ignore the entire idea folder. # option (not recommended) you can uncomment the following to ignore the entire idea folder.
#.idea/ #.idea/
.vscode

View File

@@ -1,4 +1,6 @@
# BWTAqua # BWTAqua
[![License: GPL v3](https://img.shields.io/badge/License-GPL_v3-blue.svg)](https://www.gnu.org/licenses/gpl-3.0.html)
Simple yet helpful bot to check BWT Aqua's card balance Simple yet helpful bot to check BWT Aqua's card balance
## Requirements ## Requirements
@@ -15,6 +17,7 @@ Simple yet helpful bot to check BWT Aqua's card balance
3. Install PageSaver: 3. Install PageSaver:
1. `cd PageSaver` 1. `cd PageSaver`
2. `npm install` 2. `npm install`
3. `chmod +x pageSaver` (If you want to use compiled page saver)
4. Configure the bot: 4. Configure the bot:
1. `cd ..` 1. `cd ..`
2. `nano config.json` (You can use any other text editor actually, for example `vim`) 2. `nano config.json` (You can use any other text editor actually, for example `vim`)
@@ -22,5 +25,5 @@ Simple yet helpful bot to check BWT Aqua's card balance
* `python3 bwtbot.py` * `python3 bwtbot.py`
## Configuration ## Configuration
You can edit with vim, nano, on Windows it's Notepad or Notepad++. Whatever. You can edit with vim, nano, whatever.
If you don't know where to find bot_token and your id - here you can find some hints: [get bot token](https://www.siteguarding.com/en/how-to-get-telegram-bot-api-token), [get your id](https://www.alphr.com/telegram-find-user-id/), [get api_hash and api_id](https://core.telegram.org/api/obtaining_api_id). If you don't know where to find bot_token and your id - here you can find some hints: [get bot token](https://www.siteguarding.com/en/how-to-get-telegram-bot-api-token), [get your id](https://www.alphr.com/telegram-find-user-id/), [get api_hash and api_id](https://core.telegram.org/api/obtaining_api_id).

View File

@@ -4,5 +4,6 @@
"api_id": 0, "api_id": 0,
"api_hash": "", "api_hash": "",
"bot_token": "", "bot_token": "",
"bot_name": "" "bot_name": "",
"use_compiled_page_saver": false
} }

View File

@@ -1,3 +1,5 @@
#-*- coding: utf-8 -*-
import json import json
import os import os
import shutil import shutil

View File

@@ -17,7 +17,11 @@ async def getWaterLeft(cardid, filename, app=None):
try: try:
os.system(f'touch data/pages/{str(filename)}.html') os.system(f'touch data/pages/{str(filename)}.html')
os.system(f'PageSaver/pageSaver "https://bwtaqua.com.ua/card-topup/?id={cardid}" > data/pages/{str(filename)}.html')
if config["use_compiled_page_saver"]:
os.system(f'PageSaver/pageSaver "https://bwtaqua.com.ua/card-topup/?id={cardid}" > data/pages/{str(filename)}.html')
else:
os.system(f'node ./PageSaver/pageSaver.js "https://bwtaqua.com.ua/card-topup/?id={cardid}" > data/pages/{str(filename)}.html')
with open(f'data/pages/{str(filename)}.html') as f: with open(f'data/pages/{str(filename)}.html') as f:
html_file = f.read() html_file = f.read()

View File

@@ -1 +1,3 @@
beautifulsoup4 beautifulsoup4~=4.11.1
pyrogram~=2.0.70
pathlib~=1.0.1