-
Notifications
You must be signed in to change notification settings - Fork 106
Expand file tree
/
Copy pathmain.py
More file actions
289 lines (244 loc) · 11.1 KB
/
main.py
File metadata and controls
289 lines (244 loc) · 11.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
# -*- coding: utf-8 -*-
"""
MasterCryptoFarmBot - CLI Interface
Central platform for managing multiple Telegram Air-Drop farming bots.
"""
import subprocess
import sys
import os
from pathlib import Path
from rich.console import Console
from rich.panel import Panel
from rich.prompt import Prompt
from rich.table import Table
from utils import ensure_env
console = Console()
# ASCII Art Logo
LOGO = r"""
__ __ _ _____ _ ______ ____ _
| \/ | | | / ____| | | | ____| | _ \ | |
| \ / | __ _ ___| |_ ___ _ __| | _ __ _ _ _ __ | |_ ___ | |__ __ _ _ __ _ __ ___ | |_) | ___ | |_
| |\/| |/ _` / __| __/ _ \ '__| | | '__| | | | '_ \| __/ _ \| __/ _` | '__| '_ ` _ \| _ < / _ \| __|
| | | | (_| \__ \ || __/ | | |____| | | |_| | |_) | || (_) | | | (_| | | | | | | | | |_) | (_) | |_
|_| |_|\__,_|___/\__\___|_| \_____|_| \__, | .__/ \__\___/|_| \__,_|_| |_| |_| |_|____/ \___/ \__|
__/ | |
|___/|_|
"""
# Available modules from README
MODULES = [
("Hamster Kombat", "Farm/Claimer Bot - Buys cards, completes tasks, plays playground"),
("Blum", "Farm/Claimer Bot - Registers accounts, claims rewards, completes all tasks"),
("Zoo", "Farm/Claimer Bot - Auto claim, tasks, buy animals, alliance support"),
("NotPixel", "Farm/Claimer Bot - Paints automatically, joins templates"),
("PAWS", "Claimer Bot - Registers, claims rewards"),
("Hrum", "Farm/Claimer Bot - Claims cookies, daily rewards, Ribble task"),
("Tiny Verse", "Farm/Claimer Bot - Farming, crafting, gifting stars"),
("Bums", "Farm/Claimer Bot - Taps, tasks, expeditions, daily boxes"),
("Seed", "Farm/Claimer Bot - Hunts, catches worms, free birds"),
("TimeFarm", "Farm/Claimer Bot - Auto-stakes, upgrades clocks"),
("Major", "Farm/Claimer Bot - Games, daily rewards"),
("PocketFi", "Farm/Claimer Bot - Mining rewards, alliance"),
("Cats&Dogs", "Farm/Claimer Bot - Daily rewards, tasks"),
]
def clear_screen():
"""Clear terminal screen."""
os.system('cls' if os.name == 'nt' else 'clear')
def show_logo():
"""Display the logo in a styled panel."""
console.print(Panel(LOGO, style="bold cyan", border_style="bright_blue", padding=(0, 2)))
console.print()
def install_dependencies():
"""Install Python dependencies."""
clear_screen()
show_logo()
console.print(Panel("[bold]Install Dependencies[/bold]", style="cyan", border_style="bright_blue"))
console.print()
requirements_path = Path(__file__).parent / "requirements.txt"
if not requirements_path.exists():
console.print("[yellow]! requirements.txt not found. Creating default...[/yellow]")
with open(requirements_path, "w", encoding="utf-8") as f:
f.write("rich>=13.0.0\n")
console.print("[cyan]Installing dependencies from requirements.txt...[/cyan]")
try:
result = subprocess.run(
[sys.executable, "-m", "pip", "install", "-r", str(requirements_path), "--upgrade"],
capture_output=False
)
if result.returncode == 0:
console.print("\n[bold green]Dependencies installed successfully![/bold green]")
else:
console.print("\n[bold red]Installation failed. Check errors above.[/bold red]")
except Exception as e:
console.print(f"[bold red]Error: {e}[/bold red]")
console.print("\n[dim]Press Enter to return to menu...[/dim]")
input()
def show_settings():
"""Display and manage settings."""
clear_screen()
show_logo()
console.print(Panel("[bold]Settings[/bold]", style="cyan", border_style="bright_blue"))
console.print()
config_path = Path(__file__).parent / "config" / "settings.json"
config_path.parent.mkdir(parents=True, exist_ok=True)
settings_data = {}
if config_path.exists():
try:
import json
with open(config_path, "r", encoding="utf-8") as f:
settings_data = json.load(f)
except Exception:
pass
table = Table(show_header=True, header_style="bold magenta")
table.add_column("Setting", style="cyan")
table.add_column("Value", style="green")
api_type = settings_data.get("api_type", "Pyrogram")
auto_update = settings_data.get("auto_update", True)
multi_threading = settings_data.get("multi_threading", True)
table.add_row("API Type (WebQuery/Pyrogram/Telethon)", str(api_type))
table.add_row("Auto Update", str(auto_update))
table.add_row("Multi-Threading", str(multi_threading))
console.print(table)
console.print()
console.print("[dim]Available API options: WebQuery, Pyrogram, Telethon[/dim]")
choice = Prompt.ask("\nChange setting", choices=["1", "2", "3", "0"], default="0")
if choice == "1":
new_api = Prompt.ask("API Type", choices=["WebQuery", "Pyrogram", "Telethon"], default="Pyrogram")
settings_data["api_type"] = new_api
elif choice == "2":
settings_data["auto_update"] = not settings_data.get("auto_update", True)
elif choice == "3":
settings_data["multi_threading"] = not settings_data.get("multi_threading", True)
if choice != "0":
try:
import json
with open(config_path, "w", encoding="utf-8") as f:
json.dump(settings_data, f, indent=2)
console.print("[green]Settings saved![/green]")
except Exception as e:
console.print(f"[red]Error saving: {e}[/red]")
console.print("\n[dim]Press Enter to return to menu...[/dim]")
input()
def show_about():
"""Display About information from README."""
clear_screen()
show_logo()
about_text = """
[bold cyan]MasterCryptoFarmBot[/bold cyan] - cutting-edge Telegram Air-Drop farming bot.
[bold]Key Features:[/bold]
• [green]Modular Design[/green] - Add, install, manage Bot Modules
• [green]Unified Farming[/green] - Farm from multiple Telegram bots
• [green]Web-Based GUI[/green] - Manage all bots in one place
• [green]Auto Updates[/green] - Automatic project & module updates
• [green]Multi-Threading[/green] - Run multiple bots simultaneously
• [green]Flexible API[/green] - WebQuery, Pyrogram, Telethon support
• [green]Free & Paid Modules[/green] - Some modules may require payment
[bold yellow]! Use at your own risk. Bots are forbidden in crypto air-drops.[/bold yellow]
[bold]Links:[/bold]
• [link=https://t.me/MasterCryptoFarmBot]Telegram Channel[/link]
• [link=https://t.me/MasterCryptoFarmBot]Telegram Group[/link]
• [link=https://github.com]GitHub[/link]
[bold]Donations:[/bold]
• TON: masterking32.ton
• EVM: 0x517f07305D6ED781A089322B6cD93d1461bF8652
• TRC20: TLApdY8APWkFHHoxebxGY8JhMeChiETqFH
[bold]Developed by:[/bold] [cyan]MasterkinG32[/cyan]
"""
console.print(Panel(about_text.strip(), title="[bold]About[/bold]", style="cyan", border_style="bright_blue", padding=(1, 2)))
# Show hashtags from about folder
hashtags_path = Path(__file__).parent / "about" / "hashtags.txt"
if hashtags_path.exists():
with open(hashtags_path, "r", encoding="utf-8") as f:
hashtags = f.read()
console.print(Panel(hashtags, title="[bold]#Hashtags[/bold]", style="dim", border_style="dim"))
console.print("\n[dim]Press Enter to return to menu...[/dim]")
input()
def show_modules():
"""Display available bot modules."""
clear_screen()
show_logo()
console.print(Panel("[bold]Available Modules[/bold]", style="cyan", border_style="bright_blue"))
console.print()
table = Table(show_header=True, header_style="bold magenta")
table.add_column("#", style="dim", width=3)
table.add_column("Module", style="cyan")
table.add_column("Description", style="green")
for i, (name, desc) in enumerate(MODULES, 1):
table.add_row(str(i), name, desc[:60] + "..." if len(desc) > 60 else desc)
console.print(table)
console.print()
console.print("[dim]Install modules via GitHub Wiki. Some modules may require payment.[/dim]")
console.print("\n[dim]Press Enter to return to menu...[/dim]")
input()
def run_bot():
"""Placeholder for running the main bot."""
clear_screen()
show_logo()
console.print(Panel("[bold]Run Bot[/bold]", style="cyan", border_style="bright_blue"))
console.print()
console.print("[yellow]Bot execution requires full MasterCryptoFarmBot setup.[/yellow]")
console.print("[dim]Please check GitHub Wiki for installation instructions.[/dim]")
console.print("\n[dim]Press Enter to return to menu...[/dim]")
input()
def check_updates():
"""Check for project updates."""
clear_screen()
show_logo()
console.print(Panel("[bold]Auto Update[/bold]", style="cyan", border_style="bright_blue"))
console.print()
console.print("[green]Checking for updates...[/green]")
console.print("[dim]Git pull would run here in full installation.[/dim]")
console.print("\n[green]Update check complete.[/green]")
console.print("\n[dim]Press Enter to return to menu...[/dim]")
input()
def show_tutorial():
"""Show tutorial info."""
clear_screen()
show_logo()
console.print(Panel("[bold]Tutorial[/bold]", style="cyan", border_style="bright_blue"))
console.print()
console.print("For step-by-step installation guide:")
console.print("[link=https://youtube.com]Watch MasterCryptoFarmBot Tutorial on YouTube[/link]")
console.print("\n[dim]Check GitHub Wiki for detailed instructions.[/dim]")
console.print("\n[dim]Press Enter to return to menu...[/dim]")
input()
@ensure_env
def main_menu():
"""Main menu loop."""
while True:
clear_screen()
show_logo()
console.print(Panel(
"[bold]Select an option:[/bold]\n\n"
" [cyan]1[/cyan] - Install Dependencies\n"
" [cyan]2[/cyan] - Settings\n"
" [cyan]3[/cyan] - About\n"
" [cyan]4[/cyan] - Available Modules\n"
" [cyan]5[/cyan] - Run Bot\n"
" [cyan]6[/cyan] - Check Updates\n"
" [cyan]7[/cyan] - Tutorial\n"
" [cyan]0[/cyan] - Exit\n",
title="[bold]Menu[/bold]",
style="cyan",
border_style="bright_blue",
padding=(1, 2)
))
choice = Prompt.ask("\n[bold]Your choice[/bold]", choices=["0", "1", "2", "3", "4", "5", "6", "7"], default="0")
if choice == "0":
console.print("\n[bold cyan]Thanks for using MasterCryptoFarmBot![/bold cyan]\n")
break
elif choice == "1":
install_dependencies()
elif choice == "2":
show_settings()
elif choice == "3":
show_about()
elif choice == "4":
show_modules()
elif choice == "5":
run_bot()
elif choice == "6":
check_updates()
elif choice == "7":
show_tutorial()
if __name__ == "__main__":
main_menu()