forked from Desamod/PawsBot
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
0 parents
commit 25fd7a1
Showing
37 changed files
with
1,232 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
API_ID= | ||
API_HASH= | ||
|
||
|
||
SLEEP_TIME= | ||
START_DELAY= | ||
AUTO_TASK= | ||
JOIN_TG_CHANNELS= | ||
REF_ID= |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
.env | ||
|
||
sessions/ | ||
|
||
.idea/ | ||
|
||
__pycache__ | ||
|
||
*.session | ||
|
||
*.cpython-310.pyc | ||
|
||
registered_sessions.txt |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
FROM python:3.10.11-alpine3.18 | ||
|
||
WORKDIR app/ | ||
|
||
COPY requirements.txt requirements.txt | ||
|
||
RUN pip3 install --upgrade pip setuptools wheel | ||
RUN pip3 install --no-warn-script-location --no-cache-dir -r requirements.txt | ||
|
||
COPY . . | ||
|
||
CMD ["python3", "main.py", "-a", "1"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,201 @@ | ||
Apache License | ||
Version 2.0, January 2004 | ||
http://www.apache.org/licenses/ | ||
|
||
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION | ||
|
||
1. Definitions. | ||
|
||
"License" shall mean the terms and conditions for use, reproduction, | ||
and distribution as defined by Sections 1 through 9 of this document. | ||
|
||
"Licensor" shall mean the copyright owner or entity authorized by | ||
the copyright owner that is granting the License. | ||
|
||
"Legal Entity" shall mean the union of the acting entity and all | ||
other entities that control, are controlled by, or are under common | ||
control with that entity. For the purposes of this definition, | ||
"control" means (i) the power, direct or indirect, to cause the | ||
direction or management of such entity, whether by contract or | ||
otherwise, or (ii) ownership of fifty percent (50%) or more of the | ||
outstanding shares, or (iii) beneficial ownership of such entity. | ||
|
||
"You" (or "Your") shall mean an individual or Legal Entity | ||
exercising permissions granted by this License. | ||
|
||
"Source" form shall mean the preferred form for making modifications, | ||
including but not limited to software source code, documentation | ||
source, and configuration files. | ||
|
||
"Object" form shall mean any form resulting from mechanical | ||
transformation or translation of a Source form, including but | ||
not limited to compiled object code, generated documentation, | ||
and conversions to other media types. | ||
|
||
"Work" shall mean the work of authorship, whether in Source or | ||
Object form, made available under the License, as indicated by a | ||
copyright notice that is included in or attached to the work | ||
(an example is provided in the Appendix below). | ||
|
||
"Derivative Works" shall mean any work, whether in Source or Object | ||
form, that is based on (or derived from) the Work and for which the | ||
editorial revisions, annotations, elaborations, or other modifications | ||
represent, as a whole, an original work of authorship. For the purposes | ||
of this License, Derivative Works shall not include works that remain | ||
separable from, or merely link (or bind by name) to the interfaces of, | ||
the Work and Derivative Works thereof. | ||
|
||
"Contribution" shall mean any work of authorship, including | ||
the original version of the Work and any modifications or additions | ||
to that Work or Derivative Works thereof, that is intentionally | ||
submitted to Licensor for inclusion in the Work by the copyright owner | ||
or by an individual or Legal Entity authorized to submit on behalf of | ||
the copyright owner. For the purposes of this definition, "submitted" | ||
means any form of electronic, verbal, or written communication sent | ||
to the Licensor or its representatives, including but not limited to | ||
communication on electronic mailing lists, source code control systems, | ||
and issue tracking systems that are managed by, or on behalf of, the | ||
Licensor for the purpose of discussing and improving the Work, but | ||
excluding communication that is conspicuously marked or otherwise | ||
designated in writing by the copyright owner as "Not a Contribution." | ||
|
||
"Contributor" shall mean Licensor and any individual or Legal Entity | ||
on behalf of whom a Contribution has been received by Licensor and | ||
subsequently incorporated within the Work. | ||
|
||
2. Grant of Copyright License. Subject to the terms and conditions of | ||
this License, each Contributor hereby grants to You a perpetual, | ||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable | ||
copyright license to reproduce, prepare Derivative Works of, | ||
publicly display, publicly perform, sublicense, and distribute the | ||
Work and such Derivative Works in Source or Object form. | ||
|
||
3. Grant of Patent License. Subject to the terms and conditions of | ||
this License, each Contributor hereby grants to You a perpetual, | ||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable | ||
(except as stated in this section) patent license to make, have made, | ||
use, offer to sell, sell, import, and otherwise transfer the Work, | ||
where such license applies only to those patent claims licensable | ||
by such Contributor that are necessarily infringed by their | ||
Contribution(s) alone or by combination of their Contribution(s) | ||
with the Work to which such Contribution(s) was submitted. If You | ||
institute patent litigation against any entity (including a | ||
cross-claim or counterclaim in a lawsuit) alleging that the Work | ||
or a Contribution incorporated within the Work constitutes direct | ||
or contributory patent infringement, then any patent licenses | ||
granted to You under this License for that Work shall terminate | ||
as of the date such litigation is filed. | ||
|
||
4. Redistribution. You may reproduce and distribute copies of the | ||
Work or Derivative Works thereof in any medium, with or without | ||
modifications, and in Source or Object form, provided that You | ||
meet the following conditions: | ||
|
||
(a) You must give any other recipients of the Work or | ||
Derivative Works a copy of this License; and | ||
|
||
(b) You must cause any modified files to carry prominent notices | ||
stating that You changed the files; and | ||
|
||
(c) You must retain, in the Source form of any Derivative Works | ||
that You distribute, all copyright, patent, trademark, and | ||
attribution notices from the Source form of the Work, | ||
excluding those notices that do not pertain to any part of | ||
the Derivative Works; and | ||
|
||
(d) If the Work includes a "NOTICE" text file as part of its | ||
distribution, then any Derivative Works that You distribute must | ||
include a readable copy of the attribution notices contained | ||
within such NOTICE file, excluding those notices that do not | ||
pertain to any part of the Derivative Works, in at least one | ||
of the following places: within a NOTICE text file distributed | ||
as part of the Derivative Works; within the Source form or | ||
documentation, if provided along with the Derivative Works; or, | ||
within a display generated by the Derivative Works, if and | ||
wherever such third-party notices normally appear. The contents | ||
of the NOTICE file are for informational purposes only and | ||
do not modify the License. You may add Your own attribution | ||
notices within Derivative Works that You distribute, alongside | ||
or as an addendum to the NOTICE text from the Work, provided | ||
that such additional attribution notices cannot be construed | ||
as modifying the License. | ||
|
||
You may add Your own copyright statement to Your modifications and | ||
may provide additional or different license terms and conditions | ||
for use, reproduction, or distribution of Your modifications, or | ||
for any such Derivative Works as a whole, provided Your use, | ||
reproduction, and distribution of the Work otherwise complies with | ||
the conditions stated in this License. | ||
|
||
5. Submission of Contributions. Unless You explicitly state otherwise, | ||
any Contribution intentionally submitted for inclusion in the Work | ||
by You to the Licensor shall be under the terms and conditions of | ||
this License, without any additional terms or conditions. | ||
Notwithstanding the above, nothing herein shall supersede or modify | ||
the terms of any separate license agreement you may have executed | ||
with Licensor regarding such Contributions. | ||
|
||
6. Trademarks. This License does not grant permission to use the trade | ||
names, trademarks, service marks, or product names of the Licensor, | ||
except as required for reasonable and customary use in describing the | ||
origin of the Work and reproducing the content of the NOTICE file. | ||
|
||
7. Disclaimer of Warranty. Unless required by applicable law or | ||
agreed to in writing, Licensor provides the Work (and each | ||
Contributor provides its Contributions) on an "AS IS" BASIS, | ||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or | ||
implied, including, without limitation, any warranties or conditions | ||
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A | ||
PARTICULAR PURPOSE. You are solely responsible for determining the | ||
appropriateness of using or redistributing the Work and assume any | ||
risks associated with Your exercise of permissions under this License. | ||
|
||
8. Limitation of Liability. In no event and under no legal theory, | ||
whether in tort (including negligence), contract, or otherwise, | ||
unless required by applicable law (such as deliberate and grossly | ||
negligent acts) or agreed to in writing, shall any Contributor be | ||
liable to You for damages, including any direct, indirect, special, | ||
incidental, or consequential damages of any character arising as a | ||
result of this License or out of the use or inability to use the | ||
Work (including but not limited to damages for loss of goodwill, | ||
work stoppage, computer failure or malfunction, or any and all | ||
other commercial damages or losses), even if such Contributor | ||
has been advised of the possibility of such damages. | ||
|
||
9. Accepting Warranty or Additional Liability. While redistributing | ||
the Work or Derivative Works thereof, You may choose to offer, | ||
and charge a fee for, acceptance of support, warranty, indemnity, | ||
or other liability obligations and/or rights consistent with this | ||
License. However, in accepting such obligations, You may act only | ||
on Your own behalf and on Your sole responsibility, not on behalf | ||
of any other Contributor, and only if You agree to indemnify, | ||
defend, and hold each Contributor harmless for any liability | ||
incurred by, or claims asserted against, such Contributor by reason | ||
of your accepting any such warranty or additional liability. | ||
|
||
END OF TERMS AND CONDITIONS | ||
|
||
APPENDIX: How to apply the Apache License to your work. | ||
|
||
To apply the Apache License to your work, attach the following | ||
boilerplate notice, with the fields enclosed by brackets "[]" | ||
replaced with your own identifying information. (Don't include | ||
the brackets!) The text should be enclosed in the appropriate | ||
comment syntax for the file format. We also recommend that a | ||
file or class name and description of purpose be included on the | ||
same "printed page" as the copyright notice for easier | ||
identification within third-party archives. | ||
|
||
Copyright [yyyy] [name of copyright owner] | ||
|
||
Licensed under the Apache License, Version 2.0 (the "License"); | ||
you may not use this file except in compliance with the License. | ||
You may obtain a copy of the License at | ||
|
||
http://www.apache.org/licenses/LICENSE-2.0 | ||
|
||
Unless required by applicable law or agreed to in writing, software | ||
distributed under the License is distributed on an "AS IS" BASIS, | ||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
See the License for the specific language governing permissions and | ||
limitations under the License. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,123 @@ | ||
[![Static Badge](https://img.shields.io/badge/Telegram-Bot%20Link-Link?style=for-the-badge&logo=Telegram&logoColor=white&logoSize=auto&color=blue)](https://t.me/PAWSOG_bot/PAWS?startapp=idqtVYZG) | ||
|
||
## Рекомендация перед использованием | ||
|
||
# 🔥🔥 Используйте PYTHON 3.10 🔥🔥 | ||
|
||
> 🇪🇳 README in english available [here](README.md) | ||
## Функционал | ||
| Функционал | Поддерживается | | ||
|-------------------------------------------------|:--------------:| | ||
| Многопоточность | ✅ | | ||
| Поддержка pyrogram .session / telethon .session | ✅ | | ||
| Привязка прокси к сессии | ✅ | | ||
| Привязка User-Agent к сессии | ✅ | | ||
| Авторегистрация в боте | ✅ | | ||
| Авто-выполнение заданий | ✅ | | ||
|
||
|
||
|
||
## [Настройки](https://github.com/Desamod/PawsBot/blob/master/.env-example/) | ||
| Настройка | Описание | | ||
|-------------------------|:----------------------------------------------------------:| | ||
| **API_ID / API_HASH** | Данные платформы, с которой запускать сессию Telegram | | ||
| **SLEEP_TIME** | Время сна между циклами (по умолчанию - [7200, 10800]) | | ||
| **START_DELAY** | Задержка между сессиями на старте (по умолчанию - [5, 25]) | | ||
| **AUTO_TASK** | Автовыполнение тасок (по умолчанию - True) | | ||
| **JOIN_CHANNELS** | Авто-подписка на ТГ каналы из тасок (по умолчанию - False) | | ||
| **REF_ID** | Реф. ссылка для регистрации в боте | | ||
|
||
## Быстрый старт 📚 | ||
|
||
Для быстрой установки и последующего запуска - запустите файл run.bat на Windows или run.sh на Линукс | ||
|
||
## Предварительные условия | ||
Прежде чем начать, убедитесь, что у вас установлено следующее: | ||
- [Python](https://www.python.org/downloads/) **версии 3.10** | ||
|
||
## Получение API ключей | ||
1. Перейдите на сайт [my.telegram.org](https://my.telegram.org) и войдите в систему, используя свой номер телефона. | ||
2. Выберите **"API development tools"** и заполните форму для регистрации нового приложения. | ||
3. Запишите `API_ID` и `API_HASH` в файле `.env`, предоставленные после регистрации вашего приложения. | ||
|
||
## Установка | ||
Вы можете скачать [**Репозиторий**](https://github.com/Desamod/PawsBot) клонированием на вашу систему и установкой необходимых зависимостей: | ||
```shell | ||
git clone https://github.com/Desamod/PawsBot | ||
cd PawsBot | ||
``` | ||
|
||
Затем для автоматической установки введите: | ||
|
||
Windows: | ||
```shell | ||
run.bat | ||
``` | ||
|
||
Linux: | ||
```shell | ||
run.sh | ||
``` | ||
|
||
# Linux ручная установка | ||
```shell | ||
python3 -m venv venv | ||
source venv/bin/activate | ||
pip3 install -r requirements.txt | ||
cp .env-example .env | ||
nano .env # Здесь вы обязательно должны указать ваши API_ID и API_HASH , остальное берется по умолчанию | ||
python3 main.py | ||
``` | ||
|
||
Также для быстрого запуска вы можете использовать аргументы, например: | ||
```shell | ||
~/PawsBot >>> python3 main.py --action (1/2) | ||
# Or | ||
~/PawsBot >>> python3 main.py -a (1/2) | ||
|
||
# 1 - Запускает кликер | ||
# 2 - Создает сессию (pyrogram) | ||
``` | ||
|
||
# Windows ручная установка | ||
```shell | ||
python -m venv venv | ||
venv\Scripts\activate | ||
pip install -r requirements.txt | ||
copy .env-example .env | ||
# Указываете ваши API_ID и API_HASH, остальное берется по умолчанию | ||
python main.py | ||
``` | ||
|
||
Также для быстрого запуска вы можете использовать аргументы, например: | ||
```shell | ||
~/PawsBot >>> python main.py --action (1/2) | ||
# Или | ||
~/PawsBot >>> python main.py -a (1/2) | ||
|
||
# 1 - Запускает кликер | ||
# 2 - Создает сессию (pyrogram) | ||
``` | ||
### Использование | ||
При первом запуске бота создайте для него сессию с помощью команды «2». В процессе будет создана папка 'sessions', в которой хранятся все сессии, а также файл accounts.json с конфигурациями. | ||
Если у вас уже есть сессии (pyrogram / telethon), просто поместите их в папку 'sessions' и запустите кликер. В процессе запуска вы сможете настроить использование прокси для каждой сессии. | ||
Юзер-агент создается для каждого аккаунта автоматически. | ||
|
||
Пример того, как должен выглядеть accounts.json: | ||
```shell | ||
[ | ||
{ | ||
"session_name": "name_example", | ||
"user_agent": "Mozilla/5.0 (Linux; Android 14) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/125.0.6422.165 Mobile Safari/537.36", | ||
"proxy": "type://user:pass:ip:port" # "proxy": "" - если прокси не используется | ||
} | ||
] | ||
``` | ||
|
||
### Контакты | ||
|
||
Для поддержки или вопросов, вы можете связаться со мной | ||
|
||
[![Static Badge](https://img.shields.io/badge/Telegram-Channel-Link?style=for-the-badge&logo=Telegram&logoColor=white&logoSize=auto&color=blue)](https://t.me/desforge_cryptwo) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,127 @@ | ||
[![Static Badge](https://img.shields.io/badge/Telegram-Bot%20Link-Link?style=for-the-badge&logo=Telegram&logoColor=white&logoSize=auto&color=blue)](https://t.me/PAWSOG_bot/PAWS?startapp=idqtVYZG) | ||
|
||
## Recommendation before use | ||
|
||
# 🔥🔥 Use PYTHON 3.10 🔥🔥 | ||
|
||
> 🇷 🇺 README in russian available [here](README-RU.md) | ||
## Features | ||
| Feature | Supported | | ||
|----------------------------------------------------|:---------:| | ||
| Multithreading | ✅ | | ||
| Proxy binding to session | ✅ | | ||
| User-Agent binding to session | ✅ | | ||
| Support for pyrogram .session / telethon .session | ✅ | | ||
| Registration in bot | ✅ | | ||
| Auto-tasks | ✅ | | ||
| Daily rewards | ✅ | | ||
|
||
|
||
|
||
## [Settings](https://github.com/Desamod/PawsBot/blob/master/.env-example/) | ||
| Settings | Description | | ||
|-------------------------|:---------------------------------------------------------------------------:| | ||
| **API_ID / API_HASH** | Platform data from which to run the Telegram session (by default - android) | | ||
| **SLEEP_TIME** | Sleep time between cycles (by default - [7200, 10800]) | | ||
| **START_DELAY** | Delay between sessions at start (by default - [5, 25]) | | ||
| **AUTO_TASK** | Auto tasks (default - True) | | ||
| **JOIN_CHANNELS** | Auto-join for tg channels tasks (default - False) | | ||
| **REF_ID** | Ref link for registration | | ||
|
||
## Quick Start 📚 | ||
|
||
To fast install libraries and run bot - open run.bat on Windows or run.sh on Linux | ||
|
||
## Prerequisites | ||
Before you begin, make sure you have the following installed: | ||
- [Python](https://www.python.org/downloads/) **version 3.10** | ||
|
||
## Obtaining API Keys | ||
1. Go to my.telegram.org and log in using your phone number. | ||
2. Select "API development tools" and fill out the form to register a new application. | ||
3. Record the API_ID and API_HASH provided after registering your application in the .env file. | ||
|
||
## Installation | ||
You can download the [**repository**](https://github.com/Desamod/PawsBot) by cloning it to your system and installing the necessary dependencies: | ||
```shell | ||
git clone https://github.com/Desamod/PawsBot | ||
cd PawsBot | ||
``` | ||
|
||
Then you can do automatic installation by typing: | ||
|
||
Windows: | ||
```shell | ||
run.bat | ||
``` | ||
|
||
Linux: | ||
```shell | ||
run.sh | ||
``` | ||
|
||
# Linux manual installation | ||
```shell | ||
python3 -m venv venv | ||
source venv/bin/activate | ||
pip3 install -r requirements.txt | ||
cp .env-example .env | ||
nano .env # Here you must specify your API_ID and API_HASH, the rest is taken by default | ||
python3 main.py | ||
``` | ||
|
||
You can also use arguments for quick start, for example: | ||
```shell | ||
~/PawsBot >>> python3 main.py --action (1/2) | ||
# Or | ||
~/PawsBot >>> python3 main.py -a (1/2) | ||
|
||
# 1 - Run clicker | ||
# 2 - Creates a session (pyrogram) | ||
``` | ||
|
||
# Windows manual installation | ||
```shell | ||
python -m venv venv | ||
venv\Scripts\activate | ||
pip install -r requirements.txt | ||
copy .env-example .env | ||
# Here you must specify your API_ID and API_HASH, the rest is taken by default | ||
python main.py | ||
``` | ||
|
||
You can also use arguments for quick start, for example: | ||
```shell | ||
~/PawsBot >>> python main.py --action (1/2) | ||
# Or | ||
~/PawsBot >>> python main.py -a (1/2) | ||
|
||
# 1 - Run clicker | ||
# 2 - Creates a session | ||
``` | ||
|
||
### Usages | ||
When you first launch the bot, create a session for it using the 'Creates a session' command. It will create a 'sessions' folder in which all accounts will be stored, as well as a file accounts.json with configurations. | ||
If you already have sessions (pyrogram / telethon), simply place them in a folder 'sessions' and run the clicker. During the startup process you will be able to configure the use of a proxy for each session. | ||
User-Agent is created automatically for each account. | ||
|
||
Here is an example of what accounts.json should look like: | ||
```shell | ||
[ | ||
{ | ||
"session_name": "name_example", | ||
"user_agent": "Mozilla/5.0 (Linux; Android 14) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/125.0.6422.165 Mobile Safari/537.36", | ||
"proxy": "type://user:pass:ip:port" # "proxy": "" - if you dont use proxy | ||
} | ||
] | ||
``` | ||
|
||
### Contacts | ||
|
||
For support or questions, you can contact me | ||
|
||
[![Static Badge](https://img.shields.io/badge/Telegram-Channel-Link?style=for-the-badge&logo=Telegram&logoColor=white&logoSize=auto&color=blue)](https://t.me/desforge_cryptwo) | ||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
__version__ = '1.0' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
from .config import settings |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
from pydantic_settings import BaseSettings, SettingsConfigDict | ||
|
||
|
||
class Settings(BaseSettings): | ||
model_config = SettingsConfigDict(env_file=".env", env_ignore_empty=True) | ||
|
||
API_ID: int | ||
API_HASH: str | ||
|
||
SLEEP_TIME: list[int] = [7200, 10800] | ||
START_DELAY: list[int] = [5, 25] | ||
AUTO_TASK: bool = True | ||
JOIN_TG_CHANNELS: bool = False | ||
REF_ID: str = 'idqtVYZG' | ||
DISABLED_TASKS: list[str] = ['invite', 'wallet'] | ||
|
||
|
||
settings = Settings() |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
import random | ||
|
||
|
||
def generate_random_user_agent(device_type='android', browser_type='chrome'): | ||
chrome_versions = list(range(110, 127)) | ||
firefox_versions = list(range(90, 100)) | ||
|
||
if browser_type == 'chrome': | ||
major_version = random.choice(chrome_versions) | ||
minor_version = random.randint(0, 9) | ||
build_version = random.randint(1000, 9999) | ||
patch_version = random.randint(0, 99) | ||
browser_version = f"{major_version}.{minor_version}.{build_version}.{patch_version}" | ||
elif browser_type == 'firefox': | ||
browser_version = random.choice(firefox_versions) | ||
|
||
if device_type == 'android': | ||
android_versions = ['10.0', '11.0', '12.0', '13.0'] | ||
android_device = random.choice([ | ||
'SM-G960F', 'Pixel 5', 'SM-A505F', 'Pixel 4a', 'Pixel 6 Pro', 'SM-N975F', | ||
'SM-G973F', 'Pixel 3', 'SM-G980F', 'Pixel 5a', 'SM-G998B', 'Pixel 4', | ||
'SM-G991B', 'SM-G996B', 'SM-F711B', 'SM-F916B', 'SM-G781B', 'SM-N986B', | ||
'SM-N981B', 'Pixel 2', 'Pixel 2 XL', 'Pixel 3 XL', 'Pixel 4 XL', | ||
'Pixel 5 XL', 'Pixel 6', 'Pixel 6 XL', 'Pixel 6a', 'Pixel 7', 'Pixel 7 Pro', | ||
'OnePlus 8', 'OnePlus 8 Pro', 'OnePlus 9', 'OnePlus 9 Pro', 'OnePlus Nord', 'OnePlus Nord 2', | ||
'OnePlus Nord CE', 'OnePlus 10', 'OnePlus 10 Pro', 'OnePlus 10T', 'OnePlus 10T Pro', | ||
'Xiaomi Mi 9', 'Xiaomi Mi 10', 'Xiaomi Mi 11', 'Xiaomi Redmi Note 8', 'Xiaomi Redmi Note 9', | ||
'Huawei P30', 'Huawei P40', 'Huawei Mate 30', 'Huawei Mate 40', 'Sony Xperia 1', | ||
'Sony Xperia 5', 'LG G8', 'LG V50', 'LG V60', 'Nokia 8.3', 'Nokia 9 PureView' | ||
]) | ||
android_version = random.choice(android_versions) | ||
if browser_type == 'chrome': | ||
return (f"Mozilla/5.0 (Linux; Android {android_version}; {android_device}) AppleWebKit/537.36 " | ||
f"(KHTML, like Gecko) Chrome/{browser_version} Mobile Safari/537.36") | ||
elif browser_type == 'firefox': | ||
return (f"Mozilla/5.0 (Android {android_version}; Mobile; rv:{browser_version}.0) " | ||
f"Gecko/{browser_version}.0 Firefox/{browser_version}.0") | ||
|
||
elif device_type == 'ios': | ||
ios_versions = ['13.0', '14.0', '15.0', '16.0'] | ||
ios_version = random.choice(ios_versions) | ||
if browser_type == 'chrome': | ||
return (f"Mozilla/5.0 (iPhone; CPU iPhone OS {ios_version.replace('.', '_')} like Mac OS X) " | ||
f"AppleWebKit/537.36 (KHTML, like Gecko) CriOS/{browser_version} Mobile/15E148 Safari/604.1") | ||
elif browser_type == 'firefox': | ||
return (f"Mozilla/5.0 (iPhone; CPU iPhone OS {ios_version.replace('.', '_')} like Mac OS X) " | ||
f"AppleWebKit/605.1.15 (KHTML, like Gecko) FxiOS/{browser_version}.0 Mobile/15E148 Safari/605.1.15") | ||
|
||
elif device_type == 'windows': | ||
windows_versions = ['10.0', '11.0'] | ||
windows_version = random.choice(windows_versions) | ||
if browser_type == 'chrome': | ||
return (f"Mozilla/5.0 (Windows NT {windows_version}; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) " | ||
f"Chrome/{browser_version} Safari/537.36") | ||
elif browser_type == 'firefox': | ||
return (f"Mozilla/5.0 (Windows NT {windows_version}; Win64; x64; rv:{browser_version}.0) " | ||
f"Gecko/{browser_version}.0 Firefox/{browser_version}.0") | ||
|
||
elif device_type == 'ubuntu': | ||
if browser_type == 'chrome': | ||
return (f"Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:94.0) AppleWebKit/537.36 (KHTML, like Gecko) " | ||
f"Chrome/{browser_version} Safari/537.36") | ||
elif browser_type == 'firefox': | ||
return (f"Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:{browser_version}.0) Gecko/{browser_version}.0 " | ||
f"Firefox/{browser_version}.0") | ||
|
||
return None |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
headers = { | ||
'Accept': 'application/json', | ||
'Accept-Language': 'ru-RU,ru;q=0.9,en-US;q=0.8,en;q=0.7', | ||
'Accept-Encoding': 'gzip, deflate, br, zstd', | ||
'Content-Type': 'application/json', | ||
'Connection': 'keep-alive', | ||
'Origin': 'https://app.paws.community', | ||
'Referer': 'https://app.paws.community/', | ||
'Sec-Fetch-Dest': 'empty', | ||
'Sec-Fetch-Mode': 'cors', | ||
'Sec-Fetch-Site': 'same-origin', | ||
'Sec-Ch-Ua': '"Google Chrome";v="125", "Chromium";v="125", "Not.A/Brand";v="24"', | ||
'Sec-Ch-Ua-mobile': '?1', | ||
'Sec-Ch-Ua-platform': '"Android"', | ||
'User-Agent': 'Mozilla/5.0 (Linux; Android 14) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/125.0.6422.165 Mobile Safari/537.36', | ||
'X-Requested-With': 'org.telegram.messenger' | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
from pyrogram import Client | ||
|
||
from bot.config import settings | ||
from bot.core.agents import generate_random_user_agent | ||
from bot.utils import logger | ||
from bot.utils.file_manager import save_to_json | ||
|
||
|
||
async def register_sessions() -> None: | ||
API_ID = settings.API_ID | ||
API_HASH = settings.API_HASH | ||
|
||
if not API_ID or not API_HASH: | ||
raise ValueError("API_ID and API_HASH not found in the .env file.") | ||
|
||
session_name = input('\nEnter the session name (press Enter to exit): ') | ||
|
||
if not session_name: | ||
return None | ||
|
||
raw_proxy = input("Input the proxy in the format type://user:pass:ip:port (press Enter to use without proxy): ") | ||
session = await get_tg_client(session_name=session_name, proxy=raw_proxy) | ||
async with session: | ||
user_data = await session.get_me() | ||
|
||
user_agent = generate_random_user_agent(device_type='android', browser_type='chrome') | ||
save_to_json(f'sessions/accounts.json', | ||
dict_={ | ||
"session_name": session_name, | ||
"user_agent": user_agent, | ||
"proxy": raw_proxy if raw_proxy else None | ||
}) | ||
logger.success(f'Session added successfully @{user_data.username} | {user_data.first_name} {user_data.last_name}') | ||
|
||
|
||
async def get_tg_client(session_name: str, proxy: str | None) -> Client: | ||
if not session_name: | ||
raise FileNotFoundError(f"Not found session {session_name}") | ||
|
||
if not settings.API_ID or not settings.API_HASH: | ||
raise ValueError("API_ID and API_HASH not found in the .env file.") | ||
|
||
proxy_dict = { | ||
"scheme": proxy.split(":")[0], | ||
"username": proxy.split(":")[1].split("//")[1], | ||
"password": proxy.split(":")[2], | ||
"hostname": proxy.split(":")[3], | ||
"port": int(proxy.split(":")[4]) | ||
} if proxy else None | ||
|
||
tg_client = Client( | ||
name=session_name, | ||
api_id=settings.API_ID, | ||
api_hash=settings.API_HASH, | ||
workdir="sessions/", | ||
plugins=dict(root="bot/plugins"), | ||
proxy=proxy_dict | ||
) | ||
|
||
return tg_client |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,222 @@ | ||
import asyncio | ||
import json | ||
from time import time | ||
|
||
import aiohttp | ||
import brotli | ||
from aiohttp_proxy import ProxyConnector | ||
from better_proxy import Proxy | ||
from bot.config import settings | ||
|
||
from bot.utils import logger | ||
from bot.exceptions import InvalidSession | ||
from .headers import headers | ||
|
||
from random import randint | ||
|
||
from ..utils.tg_manager.TGSession import TGSession | ||
|
||
|
||
class Tapper: | ||
def __init__(self, tg_session: TGSession): | ||
self.tg_session = tg_session | ||
self.session_name = tg_session.session_name | ||
self.start_param = '' | ||
self.name = '' | ||
|
||
async def login(self, http_client: aiohttp.ClientSession, tg_web_data: str, retry=0): | ||
try: | ||
payload = {'data': tg_web_data} | ||
if self.tg_session.start_param: | ||
payload['referralCode'] = self.tg_session.start_param | ||
|
||
response = await http_client.post("https://api.paws.community/v1/user/auth", json=payload, | ||
timeout=aiohttp.ClientTimeout(60)) | ||
|
||
response.raise_for_status() | ||
response_json = await response.json() | ||
auth_token = None | ||
if response_json.get('success', False): | ||
auth_token = response_json.get('data', [])[0] | ||
return auth_token | ||
|
||
except Exception as error: | ||
if retry < 5: | ||
logger.warning(f"{self.session_name} | Can't logging | Retry attempt: {retry}") | ||
await asyncio.sleep(delay=randint(5, 10)) | ||
return await self.login(http_client, tg_web_data=tg_web_data, retry=retry + 1) | ||
|
||
logger.error(f"{self.session_name} | Unknown error when logging: {error}") | ||
await asyncio.sleep(delay=randint(3, 7)) | ||
|
||
async def check_proxy(self, http_client: aiohttp.ClientSession, proxy: Proxy) -> None: | ||
try: | ||
response = await http_client.get(url='https://ipinfo.io/ip', timeout=aiohttp.ClientTimeout(20)) | ||
ip = (await response.text()) | ||
logger.info(f"{self.session_name} | Proxy IP: {ip}") | ||
except Exception as error: | ||
logger.error(f"{self.session_name} | Proxy: {proxy} | Error: {error}") | ||
|
||
async def get_all_tasks(self, http_client: aiohttp.ClientSession, retry=0): | ||
try: | ||
response = await http_client.get(f"https://api.paws.community/v1/quests/list") | ||
response.raise_for_status() | ||
response_bytes = await response.read() | ||
response_text = brotli.decompress(response_bytes) | ||
response_json = json.loads(response_text.decode('utf-8')) | ||
return response_json.get('data', []) | ||
except Exception as error: | ||
if retry < 3: | ||
logger.warning(f"{self.session_name} | Can't getting tasks | Retry attempt: {retry}") | ||
await asyncio.sleep(delay=randint(5, 10)) | ||
return await self.get_all_tasks(http_client, retry=retry + 1) | ||
|
||
logger.error(f"{self.session_name} | Unknown error when getting tasks: {error}") | ||
await asyncio.sleep(delay=3) | ||
|
||
async def processing_tasks(self, http_client: aiohttp.ClientSession): | ||
try: | ||
tasks = await self.get_all_tasks(http_client) | ||
if tasks: | ||
for task in tasks: | ||
progress = task['progress'] | ||
if not progress['claimed'] and task['code'] not in settings.DISABLED_TASKS: | ||
result = True if progress['current'] == progress['total'] else None | ||
if progress['current'] < progress['total']: | ||
if task['code'] == 'telegram': | ||
if not settings.JOIN_TG_CHANNELS: | ||
continue | ||
url = task['data'] | ||
logger.info(f"{self.session_name} | Performing TG subscription to <lc>{url}</lc>") | ||
await self.tg_session.join_tg_channel(url) | ||
result = await self.verify_task(http_client, task['_id']) | ||
|
||
elif task['code'] == 'twitter': | ||
logger.info(f"{self.session_name} | Performing <lc>{task['title']}</lc> task") | ||
result = await self.verify_task(http_client, task['_id']) | ||
if result is not None: | ||
is_claimed = await self.claim_task_reward(http_client, task['_id']) | ||
if is_claimed: | ||
rewards = task['rewards'][0] | ||
logger.success(f"{self.session_name} | Task <lc>{task['title']}</lc> completed! | " | ||
f"Reward: <e>+{rewards['amount']}</e> PAWS") | ||
else: | ||
logger.info(f"{self.session_name} | " | ||
f"Rewards for task <lc>{task['title']}</lc> not claimed") | ||
else: | ||
logger.info(f"{self.session_name} | Task <lc>{task['title']}</lc> not completed") | ||
|
||
await asyncio.sleep(delay=randint(5, 10)) | ||
|
||
except Exception as error: | ||
logger.error(f"{self.session_name} | Unknown error when processing tasks: {error}") | ||
await asyncio.sleep(delay=3) | ||
|
||
async def verify_task(self, http_client: aiohttp.ClientSession, task_id: str, retry=0): | ||
try: | ||
payload = {'questId': task_id} | ||
response = await http_client.post(f'https://api.paws.community/v1/quests/completed', | ||
json=payload, timeout=aiohttp.ClientTimeout(60)) | ||
response.raise_for_status() | ||
response_json = await response.json() | ||
status = response_json.get('success', False) and response_json.get('data', False) | ||
return status | ||
|
||
except Exception as e: | ||
if retry < 3: | ||
logger.warning(f"{self.session_name} | Can't verify task | Retry attempt: {retry}") | ||
await asyncio.sleep(delay=randint(5, 10)) | ||
return await self.verify_task(http_client, task_id, retry=retry + 1) | ||
|
||
logger.error(f"{self.session_name} | Unknown error while verifying task <lc>{task_id}</lc> | Error: {e}") | ||
await asyncio.sleep(delay=3) | ||
|
||
async def claim_task_reward(self, http_client: aiohttp.ClientSession, task_id: str): | ||
try: | ||
payload = {'questId': task_id} | ||
response = await http_client.post(f'https://api.paws.community/v1/quests/claim', | ||
json=payload, timeout=aiohttp.ClientTimeout(60)) | ||
response.raise_for_status() | ||
response_json = await response.json() | ||
status = response_json.get('success', False) or response_json.get('completed', False) | ||
return status | ||
|
||
except Exception as e: | ||
logger.error(f"{self.session_name} | Unknown error while claim reward for task <lc>{task_id}</lc> | Error: {e}") | ||
await asyncio.sleep(delay=3) | ||
|
||
async def get_user_info(self, http_client: aiohttp.ClientSession, retry=0): | ||
try: | ||
response = await http_client.get('https://api.paws.community/v1/user') | ||
response.raise_for_status() | ||
response_bytes = await response.read() | ||
response_text = brotli.decompress(response_bytes) | ||
response_json = json.loads(response_text.decode('utf-8')) | ||
if response_json.get('success', False): | ||
user_data = response_json.get('data') | ||
return user_data | ||
else: | ||
raise Exception | ||
|
||
except Exception as e: | ||
if retry < 3: | ||
logger.warning(f"{self.session_name} | Can't get user info | Retry attempt: {retry}") | ||
await asyncio.sleep(delay=randint(5, 10)) | ||
return await self.get_user_info(http_client, retry=retry + 1) | ||
|
||
logger.error(f"{self.session_name} | Unknown error while getting user info | Error: {e}") | ||
await asyncio.sleep(delay=3) | ||
|
||
async def run(self, user_agent: str, proxy: str | None) -> None: | ||
access_token_created_time = 0 | ||
proxy_conn = ProxyConnector().from_url(proxy) if proxy else None | ||
headers["User-Agent"] = user_agent | ||
|
||
async with aiohttp.ClientSession(headers=headers, connector=proxy_conn, trust_env=True, | ||
auto_decompress=False) as http_client: | ||
if proxy: | ||
await self.check_proxy(http_client=http_client, proxy=proxy) | ||
|
||
token_live_time = randint(3500, 3600) | ||
while True: | ||
try: | ||
sleep_time = randint(settings.SLEEP_TIME[0], settings.SLEEP_TIME[1]) | ||
if time() - access_token_created_time >= token_live_time: | ||
tg_web_data = await self.tg_session.get_tg_web_data() | ||
if tg_web_data is None: | ||
continue | ||
|
||
auth_token = await self.login(http_client=http_client, tg_web_data=tg_web_data) | ||
if auth_token is None: | ||
token_live_time = 0 | ||
await asyncio.sleep(randint(100, 180)) | ||
continue | ||
|
||
access_token_created_time = time() | ||
token_live_time = randint(3500, 3600) | ||
|
||
http_client.headers['Authorization'] = f'Bearer {auth_token}' | ||
user_info = await self.get_user_info(http_client=http_client) | ||
balance = user_info['gameData']['balance'] | ||
logger.info(f"{self.session_name} | Balance: <e>{balance}</e> PAWS") | ||
|
||
if settings.AUTO_TASK: | ||
await asyncio.sleep(delay=randint(5, 10)) | ||
await self.processing_tasks(http_client=http_client) | ||
|
||
logger.info(f"{self.session_name} | Sleep <y>{round(sleep_time / 60, 1)}</y> min") | ||
await asyncio.sleep(delay=sleep_time) | ||
|
||
except InvalidSession as error: | ||
raise error | ||
|
||
except Exception as error: | ||
logger.error(f"{self.session_name} | Unknown error: {error}") | ||
await asyncio.sleep(delay=randint(60, 120)) | ||
|
||
|
||
async def run_tapper(tg_session: TGSession, user_agent: str, proxy: str | None): | ||
try: | ||
await Tapper(tg_session=tg_session).run(user_agent=user_agent, proxy=proxy) | ||
except InvalidSession: | ||
logger.error(f"{tg_session.session_name} | Invalid Session") |
Binary file not shown.
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
class InvalidSession(BaseException): | ||
... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
from .logger import logger | ||
from . import launcher | ||
|
||
|
||
import os | ||
|
||
if not os.path.exists(path="sessions"): | ||
os.mkdir(path="sessions") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
import os | ||
|
||
from bot.core.agents import generate_random_user_agent | ||
from bot.utils import logger | ||
from bot.config import settings | ||
from bot.utils.file_manager import load_from_json, save_to_json | ||
|
||
|
||
class Accounts: | ||
def __init__(self): | ||
self.workdir = "sessions/" | ||
self.api_id = settings.API_ID | ||
self.api_hash = settings.API_HASH | ||
|
||
@staticmethod | ||
def get_available_accounts(sessions: list): | ||
|
||
accounts_from_json = load_from_json('sessions/accounts.json') | ||
|
||
if not accounts_from_json: | ||
raise ValueError("Can't run script | Please, add account/s in sessions/accounts.json") | ||
|
||
available_accounts = [] | ||
for session in sessions: | ||
is_session_added = False | ||
for saved_account in accounts_from_json: | ||
if saved_account['session_name'] == session: | ||
available_accounts.append(saved_account) | ||
is_session_added = True | ||
break | ||
if not is_session_added: | ||
logger.warning(f'{session}.session does not exist in sessions/accounts.json') | ||
ans = input(f"Add {session} to accounts.json? (y/N): ") | ||
if 'y' in ans.lower(): | ||
raw_proxy = input("Input the proxy in the format type://user:pass:ip:port (press Enter to use without proxy): ") | ||
user_agent = generate_random_user_agent(device_type='android', browser_type='chrome') | ||
new_account = { | ||
"session_name": session, | ||
"user_agent": user_agent, | ||
"proxy": raw_proxy | ||
} | ||
save_to_json(f'sessions/accounts.json', dict_=new_account) | ||
available_accounts.append(new_account) | ||
logger.success(f'Account {session} added successfully') | ||
|
||
return available_accounts | ||
|
||
def pars_sessions(self): | ||
sessions = [] | ||
for file in os.listdir(self.workdir): | ||
if file.endswith(".session"): | ||
sessions.append(file.replace(".session", "")) | ||
|
||
logger.info(f"Searched sessions: {len(sessions)}.") | ||
return sessions | ||
|
||
async def get_accounts(self): | ||
sessions = self.pars_sessions() | ||
available_accounts = self.get_available_accounts(sessions) | ||
|
||
if not available_accounts: | ||
raise ValueError("Available accounts not found! Please add accounts in 'sessions' folder") | ||
else: | ||
logger.success(f"Available accounts: {len(available_accounts)}.") | ||
|
||
return available_accounts |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
import json | ||
import mimetypes | ||
import os | ||
import random | ||
|
||
import aiofiles | ||
|
||
from bot.config import settings | ||
from bot.utils import logger | ||
|
||
|
||
def load_from_json(path: str): | ||
if os.path.isfile(path): | ||
with open(path, encoding='utf-8') as file: | ||
return json.load(file) | ||
else: | ||
with open(path, 'x', encoding='utf-8') as file: | ||
example = { | ||
"session_name": "name_example", | ||
"user_agent": "Mozilla/5.0 (Linux; Android 14) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/125.0.6422.165 Mobile Safari/537.36", | ||
"proxy": "type://user:pass:ip:port" | ||
} | ||
json.dump([example], file, ensure_ascii=False, indent=2) | ||
return [example] | ||
|
||
|
||
def save_to_json(path: str, dict_): | ||
if os.path.isfile(path): | ||
with open(path, 'r', encoding='utf-8') as file: | ||
data = json.load(file) | ||
|
||
data.append(dict_) | ||
with open(path, 'w', encoding='utf-8') as file: | ||
json.dump(data, file, ensure_ascii=False, indent=2) | ||
else: | ||
with open(path, 'x', encoding='utf-8') as file: | ||
json.dump([dict_], file, ensure_ascii=False, indent=2) | ||
|
||
|
||
async def get_random_cat_image(session_name: str): | ||
images = [f for f in os.listdir(settings.CATS_PATH) if f.lower().endswith(('.png', '.jpeg', '.jpg'))] | ||
if not images: | ||
logger.warning(f"Please, add cats images in '{settings.CATS_PATH}' folder") | ||
return None | ||
|
||
image = random.choice(images) | ||
logger.info(f"{session_name} | Selected image: <y>{image}</y>") | ||
image_path = os.path.join(settings.CATS_PATH, image) | ||
mime_type = mimetypes.guess_type(image_path) | ||
|
||
async with aiofiles.open(image_path, 'r+b') as file: | ||
data = await file.read() | ||
|
||
image_data = (f'Content-Disposition: form-data; name="photo"; filename="{image}"\r\n' | ||
f'Content-Type: {mime_type}\r\n\r\n').encode('utf-8') | ||
image_data += data | ||
return image_data |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
import asyncio | ||
import argparse | ||
from random import randint | ||
from typing import Any | ||
from better_proxy import Proxy | ||
|
||
from bot.config import settings | ||
from bot.utils import logger | ||
from bot.core.tapper import run_tapper | ||
from bot.core.registrator import register_sessions | ||
from bot.utils.accounts import Accounts | ||
from bot.core.tg_manager import SessionManager | ||
|
||
|
||
start_text = """ | ||
██████╗░░█████╗░░██╗░░░░░░░██╗░██████╗██████╗░░█████╗░████████╗ | ||
██╔══██╗██╔══██╗░██║░░██╗░░██║██╔════╝██╔══██╗██╔══██╗╚══██╔══╝ | ||
██████╔╝███████║░╚██╗████╗██╔╝╚█████╗░██████╦╝██║░░██║░░░██║░░░ | ||
██╔═══╝░██╔══██║░░████╔═████║░░╚═══██╗██╔══██╗██║░░██║░░░██║░░░ | ||
██║░░░░░██║░░██║░░╚██╔╝░╚██╔╝░██████╔╝██████╦╝╚█████╔╝░░░██║░░░ | ||
╚═╝░░░░░╚═╝░░╚═╝░░░╚═╝░░░╚═╝░░╚═════╝░╚═════╝░░╚════╝░░░░╚═╝░░░ | ||
by Desamod | ||
Select an action: | ||
1. Run bot | ||
2. Create session | ||
""" | ||
|
||
|
||
def get_proxy(raw_proxy: str) -> Proxy: | ||
return Proxy.from_str(proxy=raw_proxy).as_url if raw_proxy else None | ||
|
||
|
||
async def process() -> None: | ||
parser = argparse.ArgumentParser() | ||
parser.add_argument("-a", "--action", type=int, help="Action to perform") | ||
action = parser.parse_args().action | ||
|
||
if not action: | ||
print(start_text) | ||
|
||
while True: | ||
action = input("> ") | ||
|
||
if not action.isdigit(): | ||
logger.warning("Action must be number") | ||
elif action not in ["1", "2"]: | ||
logger.warning("Action must be 1 or 2") | ||
else: | ||
action = int(action) | ||
break | ||
|
||
if action == 2: | ||
await register_sessions() | ||
elif action == 1: | ||
accounts = await Accounts().get_accounts() | ||
await run_tasks(accounts=accounts) | ||
|
||
|
||
async def run_tasks(accounts: [Any, Any, list]): | ||
tasks = [] | ||
manager = SessionManager(api_id=settings.API_ID, | ||
api_hash=settings.API_HASH, | ||
peer='PAWSOG_bot', | ||
short_name='PAWS', | ||
start_param=settings.REF_ID, | ||
check_first_run=True) | ||
for account in accounts: | ||
session_name, user_agent, raw_proxy = account.values() | ||
tg_session = await manager.get_tg_session(session_name=session_name, proxy=raw_proxy) | ||
proxy = get_proxy(raw_proxy=raw_proxy) | ||
tasks.append(asyncio.create_task(run_tapper(tg_session=tg_session, user_agent=user_agent, proxy=proxy))) | ||
await asyncio.sleep(delay=randint(settings.START_DELAY[0], settings.START_DELAY[1])) | ||
|
||
await asyncio.gather(*tasks) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import sys | ||
from loguru import logger | ||
|
||
|
||
logger.remove() | ||
logger.add(sink=sys.stdout, format="<white>{time:YYYY-MM-DD HH:mm:ss}</white>" | ||
" | <level>{level: <8}</level>" | ||
" | <cyan><b>{line}</b></cyan>" | ||
" - <white><b>{message}</b></white>") | ||
logger = logger.opt(colors=True) |
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
version: '1' | ||
services: | ||
bot: | ||
container_name: 'PawsBot' | ||
build: | ||
context: . | ||
stop_signal: SIGINT | ||
restart: unless-stopped | ||
command: "python3 main.py -a 1" | ||
volumes: | ||
- .:/app |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import asyncio | ||
import sys | ||
from contextlib import suppress | ||
|
||
from bot.utils import logger | ||
from bot.utils.launcher import process | ||
|
||
|
||
async def main(): | ||
await process() | ||
|
||
|
||
if __name__ == '__main__': | ||
try: | ||
asyncio.run(main()) | ||
except KeyboardInterrupt: | ||
logger.warning("<r>Bot stopped by user...</r>") | ||
sys.exit(2) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
aiocfscrape==1.0.0 | ||
aiohttp==3.9.3 | ||
aiohttp-proxy==0.1.2 | ||
aiosignal==1.3.1 | ||
annotated-types==0.6.0 | ||
async-timeout==4.0.3 | ||
attrs==23.2.0 | ||
beautifulsoup4==4.12.3 | ||
better-proxy==1.1.5 | ||
colorama==0.4.6 | ||
DateTime==5.5 | ||
frozenlist==1.4.1 | ||
Js2Py==0.74 | ||
loguru==0.7.2 | ||
multidict==6.0.5 | ||
pyaes==1.6.1 | ||
pydantic==2.6.4 | ||
pydantic-settings==2.2.1 | ||
pydantic_core==2.16.3 | ||
pyjsparser==2.7.1 | ||
Pyrogram==2.0.106 | ||
PySocks==1.7.1 | ||
python-dotenv==1.0.1 | ||
pytz==2024.1 | ||
six==1.16.0 | ||
soupsieve==2.5 | ||
TgCrypto==1.2.5 | ||
typing_extensions==4.11.0 | ||
tzdata==2024.1 | ||
tzlocal==5.2 | ||
websockets==12.0 | ||
win32-setctime==1.1.0 | ||
yarl==1.9.4 | ||
zope.interface==6.4.post2 | ||
aiofiles~=24.1.0 | ||
Brotli~=1.1.0 | ||
opentele~=1.15.1 | ||
Telethon~=1.37.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
@echo off | ||
title PawsBot | ||
if not exist venv ( | ||
echo Creating virtual environment... | ||
python -m venv venv | ||
) | ||
|
||
echo Activating virtual environment... | ||
call venv\Scripts\activate | ||
|
||
if not exist venv\Lib\site-packages\installed ( | ||
if exist requirements.txt ( | ||
echo installing wheel for faster installing | ||
pip install wheel | ||
echo Installing dependencies... | ||
pip install -r requirements.txt | ||
echo. > venv\Lib\site-packages\installed | ||
) else ( | ||
echo requirements.txt not found, skipping dependency installation. | ||
) | ||
) else ( | ||
echo Dependencies already installed, skipping installation. | ||
) | ||
|
||
if not exist .env ( | ||
echo Copying configuration file | ||
copy .env-example .env | ||
) else ( | ||
echo Skipping .env copying | ||
) | ||
|
||
echo Starting the bot... | ||
python main.py | ||
|
||
echo done | ||
echo PLEASE EDIT .ENV FILE | ||
pause |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
#!/bin/bash | ||
|
||
# Проверка на наличие папки venv | ||
if [ ! -d "venv" ]; then | ||
echo "Creating virtual environment..." | ||
python3 -m venv venv | ||
fi | ||
|
||
echo "Activating virtual environment..." | ||
source venv/bin/activate | ||
|
||
# Проверка на наличие установленного флага в виртуальном окружении | ||
if [ ! -f "venv/installed" ]; then | ||
if [ -f "requirements.txt" ]; then | ||
echo "Installing wheel for faster installing" | ||
pip3 install wheel | ||
echo "Installing dependencies..." | ||
pip3 install -r requirements.txt | ||
touch venv/installed | ||
else | ||
echo "requirements.txt not found, skipping dependency installation." | ||
fi | ||
else | ||
echo "Dependencies already installed, skipping installation." | ||
fi | ||
|
||
if [ ! -f ".env" ]; then | ||
echo "Copying configuration file" | ||
cp .env-example .env | ||
else | ||
echo "Skipping .env copying" | ||
fi | ||
|
||
echo "Starting the bot..." | ||
python3 main.py | ||
|
||
echo "done" | ||
echo "PLEASE EDIT .ENV FILE" |