-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathmain.py
94 lines (76 loc) · 2.35 KB
/
main.py
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
import json
import asyncio
from time import time
from typing import List
from datetime import datetime
import discord
from discord.ext.commands import Bot
from cogs.fishing import Fishing
from cogs.captcha import Captcha
from cogs.hunting import Hunting
from modules.logging import logger
from cogs.startup import Startup, Config
start_time = datetime.now()
discord.utils.setup_logging()
config = json.load(open("config.json"))
bots: List[Bot] = []
async def log_function():
logger(bots, start_time, config["ClearConsole"])
async def start_bots(token: str) -> None:
if (
token == ""
or config[token]["HuntingChannel"] == 0
and config[token]["FishingChannel"] == 0
):
return
bot = Bot(command_prefix=token)
bot.log = log_function
bot.hunting_status = ""
bot.fishing_status = ""
bot.config = Config(
config[token]["HuntingChannel"],
config[token]["FishingChannel"],
config[token]["ExceptionBalls"],
config[token]["Balls"],
config[token]["FishBalls"],
config[token]["AutoBuy"],
config[token]["AutoReleaseDuplicates"],
config["Cooldowns"]["RetryCooldown"],
config["Cooldowns"]["HuntingCooldown"],
config["Cooldowns"]["FishingCooldown"],
config["CaptchaRetries"],
config["CaptchaSolver"],
config["SuspicionAvoidance"],
)
(
bot.encounters,
bot.catches,
bot.fish_encounters,
bot.fish_catches,
bot.coins_earned,
bot.duplicates,
bot.last_hunt,
bot.last_fish,
bot.auto_buy_queued,
bot.limit,
) = (0, 0, 0, 0, 0, 0, time(), time(), False, False)
bots.append(bot)
await bot.add_cog(Startup(bot))
if bot.config.fishing_channel_id != 0:
bot.fishing_status = "Starting..."
await bot.log()
await bot.add_cog(Fishing(bot))
else:
bot.fishing_status = "Disabled"
if bot.config.hunting_channel_id != 0:
bot.hunting_status = "Starting..."
await bot.log()
await bot.add_cog(Hunting(bot))
else:
bot.hunting_status = "Disabled"
if bot.config.captcha_solver:
await bot.add_cog(Captcha(bot))
await bot.start(token=token)
async def start() -> None:
await asyncio.gather(*[start_bots(token) for token in list(config.keys())[5:]])
asyncio.run(start())