Open supmyhava opened 2 months ago
bro stop update your youtube file your bot is not working
2024-09-08 20:54:24 | INFO | 86 | 0504945571 | Wait 28 seconds before start 2024-09-08 20:54:24 | INFO | 86 | 0507166010 | Wait 43 seconds before start 2024-09-08 20:54:24 | INFO | 86 | 0544548116 | Wait 18 seconds before start 2024-09-08 20:54:43 | ERROR | 92 | GLOBAL | 0544548116 | Authorization error: Telegram says: [420 FLOOD_WAIT_X] - A wait of 56 seconds is required (caused by "contacts.ResolveUsername") 2024-09-08 20:54:46 | ERROR | 399 | 0544548116 | Unknown error Traceback (most recent call last):
File "/root/MuskEmpireBot/main.py", line 13, in
File "/root/.pyenv/versions/3.11.0/lib/python3.11/asyncio/runners.py", line 190, in run
return runner.run(main)
│ │ └ <coroutine object main at 0xffffb4329600>
│ └ <function Runner.run at 0xffffb6bb4040>
└ <asyncio.runners.Runner object at 0xffffb756bcd0>
File "/root/.pyenv/versions/3.11.0/lib/python3.11/asyncio/runners.py", line 118, in run
return self._loop.run_until_complete(task)
│ │ │ └ <Task pending name='Task-1' coro=<main() running at /root/MuskEmpireBot/main.py:8> wait_for=<_GatheringFuture pending cb=[Tas...
│ │ └ <function BaseEventLoop.run_until_complete at 0xffffb6bb1bc0>
│ └ <_UnixSelectorEventLoop running=True closed=False debug=False>
└ <asyncio.runners.Runner object at 0xffffb756bcd0>
File "/root/.pyenv/versions/3.11.0/lib/python3.11/asyncio/base_events.py", line 637, in run_until_complete
self.run_forever()
│ └ <function BaseEventLoop.run_forever at 0xffffb6bb1b20>
└ <_UnixSelectorEventLoop running=True closed=False debug=False>
File "/root/.pyenv/versions/3.11.0/lib/python3.11/asyncio/base_events.py", line 604, in run_forever
self._run_once()
│ └ <function BaseEventLoop._run_once at 0xffffb6bb3920>
└ <_UnixSelectorEventLoop running=True closed=False debug=False>
File "/root/.pyenv/versions/3.11.0/lib/python3.11/asyncio/base_events.py", line 1909, in _run_once
handle._run()
│ └ <function Handle._run at 0xffffb6d3dbc0>
└ <Handle Task.task_wakeup(
File "/root/MuskEmpireBot/bot/launcher.py", line 88, in run_bot_with_delay await run_bot(tg_client=tg_client, proxy=proxy, additional_data=additional_data) │ │ │ └ [{'User-Agent': 'Mozilla/5.0 (iPad; CPU OS 17_0 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/17.0 Mobile/1... │ │ └ None │ └ <pyrogram.client.Client object at 0xffffb42440d0> └ <function run_bot at 0xffffb4c798a0>
File "/root/MuskEmpireBot/bot/core/bot.py", line 408, in run_bot await CryptoBot(tg_client=tg_client, additional_data=additional_data).run(proxy=proxy) │ │ │ └ None │ │ └ [{'User-Agent': 'Mozilla/5.0 (iPad; CPU OS 17_0 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/17.0 Mobile/1... │ └ <pyrogram.client.Client object at 0xffffb42440d0> └ <class 'bot.core.bot.CryptoBot'>
File "/root/MuskEmpireBot/bot/core/bot.py", line 351, in run if await self.login_to_app(proxy): │ │ └ None │ └ <function CryptoBot.login_to_app at 0xffffb422eac0> └ <bot.core.bot.CryptoBot object at 0xffffb423b790>
File "/root/MuskEmpireBot/bot/core/bot.py", line 322, in login_to_app self.http_client.headers["Api-Key"] = tg_web_data.hash │ │ │ └ None │ │ └ <property object at 0xffffb46153a0> │ └ <aiohttp.client.ClientSession object at 0xffffb4c84e90> └ <bot.core.bot.CryptoBot object at 0xffffb423b790>
AttributeError: 'NoneType' object has no attribute 'hash' Waiting for 5 seconds before continuing (required by "contacts.ResolveUsername") ^Ksdfsdf[0544548116] Waiting for 3 seconds before continuing (required by "contacts.ResolveUsername") ^K^K2024-09-08 20:54:58 | ERROR | 92 | GLOBAL | 0504945571 | Authorization error: Telegram says: [420 FLOOD_WAIT_X] - A wait of 12 seconds is required (caused by "contacts.ResolveUsername") 2024-09-08 20:54:58 | ERROR | 92 | GLOBAL | 0544548116 | Authorization error: Telegram says: [420 FLOOD_WAIT_X] - A wait of 89 seconds is required (caused by "contacts.ResolveUsername") ^C2024-09-08 20:55:00 | INFO | 15 | GLOBAL | Bot stopped by user
Add
from pyrogram.errors import RPCError,FloodWait
Replace this line
peer = await self.tg_client.resolve_peer(config.bot_name)
with this 👇
while True:
try:
peer = await self.tg_client.resolve_peer(config.bot_name)
break
except FloodWait as error:
seconds = error.value
self.logger.warning(f"{self.session_name} | Telegram required a wait of {seconds} seconds")
seconds += 60
self.logger.info(f"{self.session_name} | Sleep {seconds} seconds")
await asyncio.sleep(seconds)
And replace
peer = await self.tg_client.resolve_peer(chat.id)
With
while True:
try:
peer = await self.tg_client.resolve_peer(chat.id)
break
except FloodWait as error:
seconds = error.value
self.logger.warning(f"{self.session_name} | Telegram required a wait of <ly>{seconds}</ly> seconds")
seconds += 60
self.logger.info(f"{self.session_name} | Sleep <ly>{seconds}</ly> seconds")
await asyncio.sleep(seconds)
This can be solve problem ;)
in api.py file
in api.py file
Pro, i got error after repalce and run with your tips:
PS C:\Users\tuan> cd D:\Telebot\MuskEmpireBot-main
PS D:\Telebot\MuskEmpireBot-main> python main.py
Traceback (most recent call last):
File "D:\Telebot\MuskEmpireBot-main\main.py", line 3, in
Add
from pyrogram.errors import RPCError,FloodWait
Replace this line
peer = await self.tg_client.resolve_peer(config.bot_name)
with this 👇
while True: try: peer = await self.tg_client.resolve_peer(config.bot_name) break except FloodWait as error: seconds = error.value self.logger.warning(f"{self.session_name} | Telegram required a wait of {seconds} seconds") seconds += 60 self.logger.info(f"{self.session_name} | Sleep {seconds} seconds") await asyncio.sleep(seconds)
And replace
peer = await self.tg_client.resolve_peer(chat.id)
With
while True: try: peer = await self.tg_client.resolve_peer(chat.id) break except FloodWait as error: seconds = error.value self.logger.warning(f"{self.session_name} | Telegram required a wait of <ly>{seconds}</ly> seconds") seconds += 60 self.logger.info(f"{self.session_name} | Sleep <ly>{seconds}</ly> seconds") await asyncio.sleep(seconds)
This can be solve problem ;)
the problem is that the bot is flooding the api every time that bot is connecting to musk empire he add a device to the telegram app and when it reach to 50 then those errors are comming check it
in api.py file
Pro, i got error after repalce and run with your tips:
PS C:\Users\tuan> cd D:\Telebot\MuskEmpireBot-main PS D:\Telebot\MuskEmpireBot-main> python main.py Traceback (most recent call last): File "D:\Telebot\MuskEmpireBot-main\main.py", line 3, in from bot import launcher File "D:\Telebot\MuskEmpireBot-main\bot\launcher.py", line 13, in from bot.core.bot import run_bot File "D:\Telebot\MuskEmpireBot-main\bot\core\bot.py", line 20, in from .api import CryptoBotApi File "D:\Telebot\MuskEmpireBot-main\bot\core\api.py", line 63 try: ^ IndentationError: unindent does not match any outer indentation level
probably because the spaces patse all the api.py file:
import asyncio import json import random from datetime import datetime, timedelta from typing import NamedTuple from urllib.parse import parse_qs
import aiohttp from aiocache import Cache, cached from better_proxy import Proxy from pyrogram import Client, errors from pyrogram.errors import RPCError from pyrogram.raw.functions import account from pyrogram.raw.functions.messages import RequestAppWebView from pyrogram.raw.types import InputBotAppShortName, InputNotifyPeer, InputPeerNotifySettings from pytz import UTC
from bot.config.logger import log from bot.config.settings import config from bot.helper.utils import error_handler, handle_request
from .errors import TapsError from .models import FundHelper, Profile, ProfileData, PvpData, UserDataAfter from .utils import num_prettier from pyrogram.errors import RPCError,FloodWait
class TgWebData(NamedTuple): hash: str request_data: dict
class CryptoBotApi: def init(self, tg_client: Client): self.session_name = tg_client.name self.tg_client = tg_client self.user_id = None self.api_url = "https://api.xempire.io" self.need_quiz = False self.need_rebus = False self.rebus_key = "" self.errors = 0 self.logger = log.bind(session_name=self.session_name)
async def get_tg_web_data(self, proxy: str | None) -> TgWebData:
if proxy:
proxy = Proxy.from_str(proxy)
proxy_dict = {
"scheme": proxy.protocol,
"hostname": proxy.host,
"port": proxy.port,
"username": proxy.login,
"password": proxy.password,
}
else:
proxy_dict = None
self.tg_client.proxy = proxy_dict
try:
async with self.tg_client:
while True:
try:
peer = await self.tg_client.resolve_peer(config.bot_name)
break
except FloodWait as error:
seconds = error.value
self.logger.warning(f"{self.session_name} | Telegram required a wait of {seconds} seconds")
seconds += 60
self.logger.info(f"{self.session_name} | Sleep {seconds} seconds")
await asyncio.sleep(seconds)
web_view = await self.tg_client.invoke(
RequestAppWebView(
peer=peer,
app=InputBotAppShortName(bot_id=peer, short_name="game"),
platform="android",
write_allowed=True,
start_param=config.REF_ID,
)
)
tg_web_data = parse_qs(web_view.url.split("#")[1]).get("tgWebAppData")[0]
query_params = parse_qs(tg_web_data)
return TgWebData(
request_data={
"data": {
"chatId": "",
"chatInstance": tg_web_data,
"chatType": query_params.get("chat_type")[0],
"initData": tg_web_data,
"platform": "android",
"startParam": config.REF_ID,
},
},
hash=query_params.get("hash")[0],
)
except RuntimeError as error:
raise error from error
except Exception as error:
log.error(f"{self.session_name} | Authorization error: {error}")
await asyncio.sleep(delay=3)
async def join_and_archive_channel(self, channel_name: str) -> None:
try:
async with self.tg_client:
try:
chat = await self.tg_client.join_chat(channel_name)
self.logger.info(f"Successfully joined to <g>{chat.title}</g> successfully archived")
except RPCError:
self.logger.error("Channel <y>{channel_name}</y> not found")
raise
else:
await self.sleeper()
while True:
try:
peer = await self.tg_client.resolve_peer(chat.id)
break
except FloodWait as error:
seconds = error.value
self.logger.warning(f"{self.session_name} | Telegram required a wait of <ly>{seconds}</ly> seconds")
seconds += 60
self.logger.info(f"{self.session_name} | Sleep <ly>{seconds}</ly> seconds")
await asyncio.sleep(seconds)
until_date = datetime.now() + timedelta(
days=365 * 100
) # Устанавливаем максимальный срок (100 лет от текущей даты)
await self.tg_client.set_chat_mute(chat_id=chat.id, until_date=until_date)
await self.tg_client.invoke(
account.UpdateNotifySettings(
peer=InputNotifyPeer(peer=peer), settings=InputPeerNotifySettings(mute_until=2147483647)
)
)
self.logger.info(f"Successfully muted chat <g>{chat.title}</g> for channel <y>{channel_name}</y>")
await self.sleeper()
await self.tg_client.archive_chats(chat_ids=[chat.id])
self.logger.info(
f"Channel <g>{chat.title}</g> successfully archived for channel <y>{channel_name}</y>"
)
except errors.FloodWait as e:
self.logger.error(f"Waiting {e.value} seconds before the next attempt.")
await asyncio.sleep(e.value)
raise
async def sleeper(self, delay: int = config.RANDOM_SLEEP_TIME, additional_delay: int = 4) -> None:
await asyncio.sleep(random.random() * delay + additional_delay)
@error_handler()
@handle_request("/telegram/auth")
async def login(self, *, response_json: dict, json_body: dict) -> bool:
if response_json.get("success", False):
self.logger.success("Login successful")
return True
return False
@error_handler()
@handle_request("/dbs", json_body={"data": {"dbs": ["all"]}})
async def get_dbs(self, *, response_json: dict) -> dict:
return response_json["data"]
@error_handler()
@handle_request("/hero/balance/sync", json_body={"data": {}})
async def syn_hero_balance(self, *, response_json: dict) -> Profile:
self._update_money_balance(response_json)
self.logger.info(
f"Level: <blue>{self.level}</blue> | "
f"Balance: <y>{num_prettier(self.balance)}</y> | "
f"Money per hour: <g>{num_prettier(self.mph)}</g>"
)
return Profile(**response_json["data"])
@error_handler()
@handle_request("/user/data/all", json_body={"data": {}})
async def get_profile_full(self, *, response_json: dict) -> dict:
return dict(**response_json["data"])
@error_handler()
@handle_request("/user/data/after", json_body={"data": {"lang": "en"}})
async def user_data_after(self, *, response_json: dict) -> UserDataAfter:
return UserDataAfter(**response_json["data"])
@error_handler()
@handle_request("/hero/bonus/offline/claim")
async def get_offline_bonus(self, *, response_json: dict) -> None:
self._update_money_balance(response_json)
self.logger.success(f"Offline bonus claimed: <y>+{num_prettier(self.user_profile.offline_bonus)}</y>")
@error_handler()
@handle_request("/quests/daily/claim")
async def daily_reward(self, *, response_json: dict, json_body: dict) -> None:
self._update_money_balance(response_json)
@error_handler()
@handle_request("/quests/claim")
async def quest_reward_claim(self, *, response_json: dict, json_body: dict) -> bool:
self._update_money_balance(response_json)
return True
@error_handler()
@handle_request("/quests/daily/progress/claim")
async def daily_quest_reward(self, *, response_json: dict, json_body: dict) -> None:
self._update_money_balance(response_json)
@error_handler()
@handle_request("/quests/daily/progress/all")
async def all_daily_quests(self, *, response_json: dict) -> dict:
return response_json["data"]
@error_handler()
@handle_request("/quests/check")
async def quest_check(self, *, response_json: dict, json_body: dict) -> bool:
await self.sleeper()
await self.quest_reward_claim(json_body=json_body)
@error_handler()
@handle_request("/friends/claim")
async def friend_reward(self, *, response_json: dict, json_body: dict) -> None:
self._update_money_balance(response_json)
@error_handler()
@handle_request("/hero/action/tap")
async def api_perform_taps(self, *, response_json: dict, json_body: dict) -> int:
if (error_msg := response_json.get("error")) and "take some rest" in error_msg:
raise TapsError(error_msg)
data = self._update_money_balance(response_json)
self.tapped_today = data.get("tappedToday", 0)
return int(data["hero"]["earns"]["task"]["energy"])
@cached(ttl=2 * 60 * 60, cache=Cache.MEMORY)
@error_handler()
@handle_request(
"https://raw.githubusercontent.com/testingstrategy/musk_daily/main/daily.json",
method="GET",
full_url=True,
)
async def get_helper(self, *, response_json: str) -> FundHelper | dict:
response_json = json.loads(response_json)
return FundHelper(
funds=response_json.get(str(datetime.now(UTC).date()), {}).get("funds", set()),
**response_json,
)
@error_handler()
@handle_request("/fund/info")
async def get_funds_info(self, *, response_json: dict) -> dict:
return response_json["data"]
@error_handler()
@handle_request("/box/list", json_body={})
async def get_box_list(self, *, response_json: dict) -> dict:
return response_json["data"] or {}
@error_handler()
@handle_request("/box/open")
async def box_open(self, *, response_json: dict, json_body: dict) -> list:
return response_json["data"]
@error_handler()
@handle_request("/pvp/info")
async def get_pvp_info(self, *, response_json: dict) -> dict:
return response_json["data"]
@error_handler()
@handle_request("/pvp/start/fight")
async def get_pvp_fight(self, *, response_json: dict, json_body: dict) -> PvpData | None:
if response_json["data"].get("opponent"):
return PvpData(**response_json["data"])
return None
@error_handler()
@handle_request("/pvp/claim")
async def get_pvp_claim(self, *, response_json: dict) -> None:
if response_json.get("success"):
self._update_money_balance(response_json)
@error_handler()
@handle_request(
"/settings/save",
json_body={
"data": {
"id": None,
"music": False,
"sound": True,
"vibrate": True,
"animations": True,
"darkTheme": True,
"lang": "en",
}
},
)
async def sent_eng_settings(self, *, response_json: dict) -> None: ...
@error_handler()
@handle_request("/fund/invest")
async def invest(self, *, response_json: dict, json_body: dict) -> None:
data = self._update_money_balance(response_json)
for fnd in data["funds"]:
if fnd["fundKey"] == json_body["data"]["fund"]:
money = fnd["moneyProfit"]
money_str = (
f"Win: <y>+{num_prettier(money)}</y>" if money > 0 else f"Loss: <red>{num_prettier(money)}</red>"
)
self.logger.success(f"Invest completed: {money_str}")
break
@error_handler()
@handle_request("/skills/improve")
async def skills_improve(self, *, response_json: dict, json_body: dict) -> None:
self._update_money_balance(response_json)
async def check_proxy(self, proxy: Proxy) -> None:
try:
response = await self.http_client.get(url="https://httpbin.org/ip", timeout=aiohttp.ClientTimeout(10))
ip = (await response.json()).get("origin")
self.logger.info(f"Proxy IP: {ip}")
except Exception:
self.logger.exception(f"Proxy: {proxy}")
def _update_money_balance(self, response_json: dict) -> dict:
response_json = response_json["data"]
self.balance = int(response_json["hero"]["money"])
self.level = int(response_json["hero"]["level"])
self.mph = int(response_json["hero"]["moneyPerHour"])
return response_json
in api.py file
Pro, i got error after repalce and run with your tips:
PS C:\Users\tuan> cd D:\Telebot\MuskEmpireBot-main PS D:\Telebot\MuskEmpireBot-main> python main.py Traceback (most recent call last): File "D:\Telebot\MuskEmpireBot-main\main.py", line 3, in from bot import launcher File "D:\Telebot\MuskEmpireBot-main\bot\launcher.py", line 13, in from bot.core.bot import run_bot File "D:\Telebot\MuskEmpireBot-main\bot\core\bot.py", line 20, in from .api import CryptoBotApi File "D:\Telebot\MuskEmpireBot-main\bot\core\api.py", line 63 try: ^ IndentationError: unindent does not match any outer indentation level
probably because the spaces pase all the api.py file:
import asyncio import json import random from datetime import datetime, timedelta from typing import NamedTuple from urllib.parse import parse_qs
import aiohttp from aiocache import Cache, cached from better_proxy import Proxy from pyrogram import Client, errors from pyrogram.errors import RPCError from pyrogram.raw.functions import account from pyrogram.raw.functions.messages import RequestAppWebView from pyrogram.raw.types import InputBotAppShortName, InputNotifyPeer, InputPeerNotifySettings from pytz import UTC
from bot.config.logger import log from bot.config.settings import config from bot.helper.utils import error_handler, handle_request
from .errors import TapsError from .models import FundHelper, Profile, ProfileData, PvpData, UserDataAfter from .utils import num_prettier from pyrogram.errors import RPCError,FloodWait
class TgWebData(NamedTuple): hash: str request_data: dict
class CryptoBotApi: def init(self, tg_client: Client): self.session_name = tg_client.name self.tg_client = tg_client self.user_id = None self.api_url = "https://api.xempire.io" self.need_quiz = False self.need_rebus = False self.rebus_key = "" self.errors = 0 self.logger = log.bind(session_name=self.session_name)
async def get_tg_web_data(self, proxy: str | None) -> TgWebData:
if proxy:
proxy = Proxy.from_str(proxy)
proxy_dict = {
"scheme": proxy.protocol,
"hostname": proxy.host,
"port": proxy.port,
"username": proxy.login,
"password": proxy.password,
}
else:
proxy_dict = None
self.tg_client.proxy = proxy_dict
try:
async with self.tg_client:
while True:
try:
peer = await self.tg_client.resolve_peer(config.bot_name)
break
except FloodWait as error:
seconds = error.value
self.logger.warning(f"{self.session_name} | Telegram required a wait of {seconds} seconds")
seconds += 60
self.logger.info(f"{self.session_name} | Sleep {seconds} seconds")
await asyncio.sleep(seconds)
web_view = await self.tg_client.invoke(
RequestAppWebView(
peer=peer,
app=InputBotAppShortName(bot_id=peer, short_name="game"),
platform="android",
write_allowed=True,
start_param=config.REF_ID,
)
)
tg_web_data = parse_qs(web_view.url.split("#")[1]).get("tgWebAppData")[0]
query_params = parse_qs(tg_web_data)
return TgWebData(
request_data={
"data": {
"chatId": "",
"chatInstance": tg_web_data,
"chatType": query_params.get("chat_type")[0],
"initData": tg_web_data,
"platform": "android",
"startParam": config.REF_ID,
},
},
hash=query_params.get("hash")[0],
)
except RuntimeError as error:
raise error from error
except Exception as error:
log.error(f"{self.session_name} | Authorization error: {error}")
await asyncio.sleep(delay=3)
async def join_and_archive_channel(self, channel_name: str) -> None:
try:
async with self.tg_client:
try:
chat = await self.tg_client.join_chat(channel_name)
self.logger.info(f"Successfully joined to <g>{chat.title}</g> successfully archived")
except RPCError:
self.logger.error("Channel <y>{channel_name}</y> not found")
raise
else:
await self.sleeper()
while True:
try:
peer = await self.tg_client.resolve_peer(chat.id)
break
except FloodWait as error:
seconds = error.value
self.logger.warning(f"{self.session_name} | Telegram required a wait of <ly>{seconds}</ly> seconds")
seconds += 60
self.logger.info(f"{self.session_name} | Sleep <ly>{seconds}</ly> seconds")
await asyncio.sleep(seconds)
until_date = datetime.now() + timedelta(
days=365 * 100
) # Устанавливаем максимальный срок (100 лет от текущей даты)
await self.tg_client.set_chat_mute(chat_id=chat.id, until_date=until_date)
await self.tg_client.invoke(
account.UpdateNotifySettings(
peer=InputNotifyPeer(peer=peer), settings=InputPeerNotifySettings(mute_until=2147483647)
)
)
self.logger.info(f"Successfully muted chat <g>{chat.title}</g> for channel <y>{channel_name}</y>")
await self.sleeper()
await self.tg_client.archive_chats(chat_ids=[chat.id])
self.logger.info(
f"Channel <g>{chat.title}</g> successfully archived for channel <y>{channel_name}</y>"
)
except errors.FloodWait as e:
self.logger.error(f"Waiting {e.value} seconds before the next attempt.")
await asyncio.sleep(e.value)
raise
async def sleeper(self, delay: int = config.RANDOM_SLEEP_TIME, additional_delay: int = 4) -> None:
await asyncio.sleep(random.random() * delay + additional_delay)
@error_handler()
@handle_request("/telegram/auth")
async def login(self, *, response_json: dict, json_body: dict) -> bool:
if response_json.get("success", False):
self.logger.success("Login successful")
return True
return False
@error_handler()
@handle_request("/dbs", json_body={"data": {"dbs": ["all"]}})
async def get_dbs(self, *, response_json: dict) -> dict:
return response_json["data"]
@error_handler()
@handle_request("/hero/balance/sync", json_body={"data": {}})
async def syn_hero_balance(self, *, response_json: dict) -> Profile:
self._update_money_balance(response_json)
self.logger.info(
f"Level: <blue>{self.level}</blue> | "
f"Balance: <y>{num_prettier(self.balance)}</y> | "
f"Money per hour: <g>{num_prettier(self.mph)}</g>"
)
return Profile(**response_json["data"])
@error_handler()
@handle_request("/user/data/all", json_body={"data": {}})
async def get_profile_full(self, *, response_json: dict) -> dict:
return dict(**response_json["data"])
@error_handler()
@handle_request("/user/data/after", json_body={"data": {"lang": "en"}})
async def user_data_after(self, *, response_json: dict) -> UserDataAfter:
return UserDataAfter(**response_json["data"])
@error_handler()
@handle_request("/hero/bonus/offline/claim")
async def get_offline_bonus(self, *, response_json: dict) -> None:
self._update_money_balance(response_json)
self.logger.success(f"Offline bonus claimed: <y>+{num_prettier(self.user_profile.offline_bonus)}</y>")
@error_handler()
@handle_request("/quests/daily/claim")
async def daily_reward(self, *, response_json: dict, json_body: dict) -> None:
self._update_money_balance(response_json)
@error_handler()
@handle_request("/quests/claim")
async def quest_reward_claim(self, *, response_json: dict, json_body: dict) -> bool:
self._update_money_balance(response_json)
return True
@error_handler()
@handle_request("/quests/daily/progress/claim")
async def daily_quest_reward(self, *, response_json: dict, json_body: dict) -> None:
self._update_money_balance(response_json)
@error_handler()
@handle_request("/quests/daily/progress/all")
async def all_daily_quests(self, *, response_json: dict) -> dict:
return response_json["data"]
@error_handler()
@handle_request("/quests/check")
async def quest_check(self, *, response_json: dict, json_body: dict) -> bool:
await self.sleeper()
await self.quest_reward_claim(json_body=json_body)
@error_handler()
@handle_request("/friends/claim")
async def friend_reward(self, *, response_json: dict, json_body: dict) -> None:
self._update_money_balance(response_json)
@error_handler()
@handle_request("/hero/action/tap")
async def api_perform_taps(self, *, response_json: dict, json_body: dict) -> int:
if (error_msg := response_json.get("error")) and "take some rest" in error_msg:
raise TapsError(error_msg)
data = self._update_money_balance(response_json)
self.tapped_today = data.get("tappedToday", 0)
return int(data["hero"]["earns"]["task"]["energy"])
@cached(ttl=2 * 60 * 60, cache=Cache.MEMORY)
@error_handler()
@handle_request(
"https://raw.githubusercontent.com/testingstrategy/musk_daily/main/daily.json",
method="GET",
full_url=True,
)
async def get_helper(self, *, response_json: str) -> FundHelper | dict:
response_json = json.loads(response_json)
return FundHelper(
funds=response_json.get(str(datetime.now(UTC).date()), {}).get("funds", set()),
**response_json,
)
@error_handler()
@handle_request("/fund/info")
async def get_funds_info(self, *, response_json: dict) -> dict:
return response_json["data"]
@error_handler()
@handle_request("/box/list", json_body={})
async def get_box_list(self, *, response_json: dict) -> dict:
return response_json["data"] or {}
@error_handler()
@handle_request("/box/open")
async def box_open(self, *, response_json: dict, json_body: dict) -> list:
return response_json["data"]
@error_handler()
@handle_request("/pvp/info")
async def get_pvp_info(self, *, response_json: dict) -> dict:
return response_json["data"]
@error_handler()
@handle_request("/pvp/start/fight")
async def get_pvp_fight(self, *, response_json: dict, json_body: dict) -> PvpData | None:
if response_json["data"].get("opponent"):
return PvpData(**response_json["data"])
return None
@error_handler()
@handle_request("/pvp/claim")
async def get_pvp_claim(self, *, response_json: dict) -> None:
if response_json.get("success"):
self._update_money_balance(response_json)
@error_handler()
@handle_request(
"/settings/save",
json_body={
"data": {
"id": None,
"music": False,
"sound": True,
"vibrate": True,
"animations": True,
"darkTheme": True,
"lang": "en",
}
},
)
async def sent_eng_settings(self, *, response_json: dict) -> None: ...
@error_handler()
@handle_request("/fund/invest")
async def invest(self, *, response_json: dict, json_body: dict) -> None:
data = self._update_money_balance(response_json)
for fnd in data["funds"]:
if fnd["fundKey"] == json_body["data"]["fund"]:
money = fnd["moneyProfit"]
money_str = (
f"Win: <y>+{num_prettier(money)}</y>" if money > 0 else f"Loss: <red>{num_prettier(money)}</red>"
)
self.logger.success(f"Invest completed: {money_str}")
break
@error_handler()
@handle_request("/skills/improve")
async def skills_improve(self, *, response_json: dict, json_body: dict) -> None:
self._update_money_balance(response_json)
async def check_proxy(self, proxy: Proxy) -> None:
try:
response = await self.http_client.get(url="https://httpbin.org/ip", timeout=aiohttp.ClientTimeout(10))
ip = (await response.json()).get("origin")
self.logger.info(f"Proxy IP: {ip}")
except Exception:
self.logger.exception(f"Proxy: {proxy}")
def _update_money_balance(self, response_json: dict) -> dict:
response_json = response_json["data"]
self.balance = int(response_json["hero"]["money"])
self.level = int(response_json["hero"]["level"])
self.mph = int(response_json["hero"]["moneyPerHour"])
return response_json
in api.py file
Pro, i got error after repalce and run with your tips: PS C:\Users\tuan> cd D:\Telebot\MuskEmpireBot-main PS D:\Telebot\MuskEmpireBot-main> python main.py Traceback (most recent call last): File "D:\Telebot\MuskEmpireBot-main\main.py", line 3, in from bot import launcher File "D:\Telebot\MuskEmpireBot-main\bot\launcher.py", line 13, in from bot.core.bot import run_bot File "D:\Telebot\MuskEmpireBot-main\bot\core\bot.py", line 20, in from .api import CryptoBotApi File "D:\Telebot\MuskEmpireBot-main\bot\core\api.py", line 63 try: ^ IndentationError: unindent does not match any outer indentation level
probably because the spaces pase all the api.py file:
import asyncio import json import random from datetime import datetime, timedelta from typing import NamedTuple from urllib.parse import parse_qs
import aiohttp from aiocache import Cache, cached from better_proxy import Proxy from pyrogram import Client, errors from pyrogram.errors import RPCError from pyrogram.raw.functions import account from pyrogram.raw.functions.messages import RequestAppWebView from pyrogram.raw.types import InputBotAppShortName, InputNotifyPeer, InputPeerNotifySettings from pytz import UTC
from bot.config.logger import log from bot.config.settings import config from bot.helper.utils import error_handler, handle_request
from .errors import TapsError from .models import FundHelper, Profile, ProfileData, PvpData, UserDataAfter from .utils import num_prettier from pyrogram.errors import RPCError,FloodWait
class TgWebData(NamedTuple): hash: str request_data: dict
class CryptoBotApi: def init(self, tg_client: Client): self.session_name = tg_client.name self.tg_client = tg_client self.user_id = None self.api_url = "https://api.xempire.io" self.need_quiz = False self.need_rebus = False self.rebus_key = "" self.errors = 0 self.logger = log.bind(session_name=self.session_name)
async def get_tg_web_data(self, proxy: str | None) -> TgWebData: if proxy: proxy = Proxy.from_str(proxy) proxy_dict = { "scheme": proxy.protocol, "hostname": proxy.host, "port": proxy.port, "username": proxy.login, "password": proxy.password, } else: proxy_dict = None self.tg_client.proxy = proxy_dict try: async with self.tg_client: while True: try: peer = await self.tg_client.resolve_peer(config.bot_name) break except FloodWait as error: seconds = error.value self.logger.warning(f"{self.session_name} | Telegram required a wait of {seconds} seconds") seconds += 60 self.logger.info(f"{self.session_name} | Sleep {seconds} seconds") await asyncio.sleep(seconds) web_view = await self.tg_client.invoke( RequestAppWebView( peer=peer, app=InputBotAppShortName(bot_id=peer, short_name="game"), platform="android", write_allowed=True, start_param=config.REF_ID, ) ) tg_web_data = parse_qs(web_view.url.split("#")[1]).get("tgWebAppData")[0] query_params = parse_qs(tg_web_data) return TgWebData( request_data={ "data": { "chatId": "", "chatInstance": tg_web_data, "chatType": query_params.get("chat_type")[0], "initData": tg_web_data, "platform": "android", "startParam": config.REF_ID, }, }, hash=query_params.get("hash")[0], ) except RuntimeError as error: raise error from error except Exception as error: log.error(f"{self.session_name} | Authorization error: {error}") await asyncio.sleep(delay=3) async def join_and_archive_channel(self, channel_name: str) -> None: try: async with self.tg_client: try: chat = await self.tg_client.join_chat(channel_name) self.logger.info(f"Successfully joined to <g>{chat.title}</g> successfully archived") except RPCError: self.logger.error("Channel <y>{channel_name}</y> not found") raise else: await self.sleeper() while True: try: peer = await self.tg_client.resolve_peer(chat.id) break except FloodWait as error: seconds = error.value self.logger.warning(f"{self.session_name} | Telegram required a wait of <ly>{seconds}</ly> seconds") seconds += 60 self.logger.info(f"{self.session_name} | Sleep <ly>{seconds}</ly> seconds") await asyncio.sleep(seconds) until_date = datetime.now() + timedelta( days=365 * 100 ) # Устанавливаем максимальный срок (100 лет от текущей даты) await self.tg_client.set_chat_mute(chat_id=chat.id, until_date=until_date) await self.tg_client.invoke( account.UpdateNotifySettings( peer=InputNotifyPeer(peer=peer), settings=InputPeerNotifySettings(mute_until=2147483647) ) ) self.logger.info(f"Successfully muted chat <g>{chat.title}</g> for channel <y>{channel_name}</y>") await self.sleeper() await self.tg_client.archive_chats(chat_ids=[chat.id]) self.logger.info( f"Channel <g>{chat.title}</g> successfully archived for channel <y>{channel_name}</y>" ) except errors.FloodWait as e: self.logger.error(f"Waiting {e.value} seconds before the next attempt.") await asyncio.sleep(e.value) raise async def sleeper(self, delay: int = config.RANDOM_SLEEP_TIME, additional_delay: int = 4) -> None: await asyncio.sleep(random.random() * delay + additional_delay) @error_handler() @handle_request("/telegram/auth") async def login(self, *, response_json: dict, json_body: dict) -> bool: if response_json.get("success", False): self.logger.success("Login successful") return True return False @error_handler() @handle_request("/dbs", json_body={"data": {"dbs": ["all"]}}) async def get_dbs(self, *, response_json: dict) -> dict: return response_json["data"] @error_handler() @handle_request("/hero/balance/sync", json_body={"data": {}}) async def syn_hero_balance(self, *, response_json: dict) -> Profile: self._update_money_balance(response_json) self.logger.info( f"Level: <blue>{self.level}</blue> | " f"Balance: <y>{num_prettier(self.balance)}</y> | " f"Money per hour: <g>{num_prettier(self.mph)}</g>" ) return Profile(**response_json["data"]) @error_handler() @handle_request("/user/data/all", json_body={"data": {}}) async def get_profile_full(self, *, response_json: dict) -> dict: return dict(**response_json["data"]) @error_handler() @handle_request("/user/data/after", json_body={"data": {"lang": "en"}}) async def user_data_after(self, *, response_json: dict) -> UserDataAfter: return UserDataAfter(**response_json["data"]) @error_handler() @handle_request("/hero/bonus/offline/claim") async def get_offline_bonus(self, *, response_json: dict) -> None: self._update_money_balance(response_json) self.logger.success(f"Offline bonus claimed: <y>+{num_prettier(self.user_profile.offline_bonus)}</y>") @error_handler() @handle_request("/quests/daily/claim") async def daily_reward(self, *, response_json: dict, json_body: dict) -> None: self._update_money_balance(response_json) @error_handler() @handle_request("/quests/claim") async def quest_reward_claim(self, *, response_json: dict, json_body: dict) -> bool: self._update_money_balance(response_json) return True @error_handler() @handle_request("/quests/daily/progress/claim") async def daily_quest_reward(self, *, response_json: dict, json_body: dict) -> None: self._update_money_balance(response_json) @error_handler() @handle_request("/quests/daily/progress/all") async def all_daily_quests(self, *, response_json: dict) -> dict: return response_json["data"] @error_handler() @handle_request("/quests/check") async def quest_check(self, *, response_json: dict, json_body: dict) -> bool: await self.sleeper() await self.quest_reward_claim(json_body=json_body) @error_handler() @handle_request("/friends/claim") async def friend_reward(self, *, response_json: dict, json_body: dict) -> None: self._update_money_balance(response_json) @error_handler() @handle_request("/hero/action/tap") async def api_perform_taps(self, *, response_json: dict, json_body: dict) -> int: if (error_msg := response_json.get("error")) and "take some rest" in error_msg: raise TapsError(error_msg) data = self._update_money_balance(response_json) self.tapped_today = data.get("tappedToday", 0) return int(data["hero"]["earns"]["task"]["energy"]) @cached(ttl=2 * 60 * 60, cache=Cache.MEMORY) @error_handler() @handle_request( "https://raw.githubusercontent.com/testingstrategy/musk_daily/main/daily.json", method="GET", full_url=True, ) async def get_helper(self, *, response_json: str) -> FundHelper | dict: response_json = json.loads(response_json) return FundHelper( funds=response_json.get(str(datetime.now(UTC).date()), {}).get("funds", set()), **response_json, ) @error_handler() @handle_request("/fund/info") async def get_funds_info(self, *, response_json: dict) -> dict: return response_json["data"] @error_handler() @handle_request("/box/list", json_body={}) async def get_box_list(self, *, response_json: dict) -> dict: return response_json["data"] or {} @error_handler() @handle_request("/box/open") async def box_open(self, *, response_json: dict, json_body: dict) -> list: return response_json["data"] @error_handler() @handle_request("/pvp/info") async def get_pvp_info(self, *, response_json: dict) -> dict: return response_json["data"] @error_handler() @handle_request("/pvp/start/fight") async def get_pvp_fight(self, *, response_json: dict, json_body: dict) -> PvpData | None: if response_json["data"].get("opponent"): return PvpData(**response_json["data"]) return None @error_handler() @handle_request("/pvp/claim") async def get_pvp_claim(self, *, response_json: dict) -> None: if response_json.get("success"): self._update_money_balance(response_json) @error_handler() @handle_request( "/settings/save", json_body={ "data": { "id": None, "music": False, "sound": True, "vibrate": True, "animations": True, "darkTheme": True, "lang": "en", } }, ) async def sent_eng_settings(self, *, response_json: dict) -> None: ... @error_handler() @handle_request("/fund/invest") async def invest(self, *, response_json: dict, json_body: dict) -> None: data = self._update_money_balance(response_json) for fnd in data["funds"]: if fnd["fundKey"] == json_body["data"]["fund"]: money = fnd["moneyProfit"] money_str = ( f"Win: <y>+{num_prettier(money)}</y>" if money > 0 else f"Loss: <red>{num_prettier(money)}</red>" ) self.logger.success(f"Invest completed: {money_str}") break @error_handler() @handle_request("/skills/improve") async def skills_improve(self, *, response_json: dict, json_body: dict) -> None: self._update_money_balance(response_json) async def check_proxy(self, proxy: Proxy) -> None: try: response = await self.http_client.get(url="https://httpbin.org/ip", timeout=aiohttp.ClientTimeout(10)) ip = (await response.json()).get("origin") self.logger.info(f"Proxy IP: {ip}") except Exception: self.logger.exception(f"Proxy: {proxy}") def _update_money_balance(self, response_json: dict) -> dict: response_json = response_json["data"] self.balance = int(response_json["hero"]["money"]) self.level = int(response_json["hero"]["level"]) self.mph = int(response_json["hero"]["moneyPerHour"]) return response_json
pro, 319 line right?. Error: IndentationError: expected an indented block after class definition on line 20
Add
from pyrogram.errors import RPCError,FloodWait
Replace this line
peer = await self.tg_client.resolve_peer(config.bot_name)
with this 👇
while True: try: peer = await self.tg_client.resolve_peer(config.bot_name) break except FloodWait as error: seconds = error.value self.logger.warning(f"{self.session_name} | Telegram required a wait of {seconds} seconds") seconds += 60 self.logger.info(f"{self.session_name} | Sleep {seconds} seconds") await asyncio.sleep(seconds)
And replace
peer = await self.tg_client.resolve_peer(chat.id)
With
while True: try: peer = await self.tg_client.resolve_peer(chat.id) break except FloodWait as error: seconds = error.value self.logger.warning(f"{self.session_name} | Telegram required a wait of <ly>{seconds}</ly> seconds") seconds += 60 self.logger.info(f"{self.session_name} | Sleep <ly>{seconds}</ly> seconds") await asyncio.sleep(seconds)
This can be solve problem ;)
[0504945571] Waiting for 8 seconds before continuing (required by "contacts.ResolveUsername") 2024-09-09 12:18:52 | WARNING | 68 | 0504945571 | 0504945571 | Telegram required a wait of 262 seconds 2024-09-09 12:18:52 | INFO | 70 | 0504945571 | 0504945571 | Sleep 322 seconds 2024-09-09 12:23:29 | WARNING | 68 | 0507166010 | 0507166010 | Telegram required a wait of 420 seconds 2024-09-09 12:23:29 | INFO | 70 | 0507166010 | 0507166010 | Sleep 480 seconds 2024-09-09 12:24:14 | WARNING | 68 | 0504945571 | 0504945571 | Telegram required a wait of 186 seconds 2024-09-09 12:24:14 | INFO | 70 | 0504945571 | 0504945571 | Sleep 246 seconds
in api.py file
Pro, i got error after repalce and run with your tips: PS C:\Users\tuan> cd D:\Telebot\MuskEmpireBot-main PS D:\Telebot\MuskEmpireBot-main> python main.py Traceback (most recent call last): File "D:\Telebot\MuskEmpireBot-main\main.py", line 3, in from bot import launcher File "D:\Telebot\MuskEmpireBot-main\bot\launcher.py", line 13, in from bot.core.bot import run_bot File "D:\Telebot\MuskEmpireBot-main\bot\core\bot.py", line 20, in from .api import CryptoBotApi File "D:\Telebot\MuskEmpireBot-main\bot\core\api.py", line 63 try: ^ IndentationError: unindent does not match any outer indentation level
probably because the spaces pase all the api.py file:
import asyncio import json import random from datetime import datetime, timedelta from typing import NamedTuple from urllib.parse import parse_qs
import aiohttp from aiocache import Cache, cached from better_proxy import Proxy from pyrogram import Client, errors from pyrogram.errors import RPCError from pyrogram.raw.functions import account from pyrogram.raw.functions.messages import RequestAppWebView from pyrogram.raw.types import InputBotAppShortName, InputNotifyPeer, InputPeerNotifySettings from pytz import UTC from bot.config.logger import log from bot.config.settings import config from bot.helper.utils import error_handler, handle_request from .errors import TapsError from .models import FundHelper, Profile, ProfileData, PvpData, UserDataAfter from .utils import num_prettier from pyrogram.errors import RPCError,FloodWait class TgWebData(NamedTuple): hash: str request_data: dict class CryptoBotApi: def init(self, tg_client: Client): self.session_name = tg_client.name self.tg_client = tg_client self.user_id = None self.api_url = "https://api.xempire.io" self.need_quiz = False self.need_rebus = False self.rebus_key = "" self.errors = 0 self.logger = log.bind(session_name=self.session_name)
async def get_tg_web_data(self, proxy: str | None) -> TgWebData: if proxy: proxy = Proxy.from_str(proxy) proxy_dict = { "scheme": proxy.protocol, "hostname": proxy.host, "port": proxy.port, "username": proxy.login, "password": proxy.password, } else: proxy_dict = None self.tg_client.proxy = proxy_dict try: async with self.tg_client: while True: try: peer = await self.tg_client.resolve_peer(config.bot_name) break except FloodWait as error: seconds = error.value self.logger.warning(f"{self.session_name} | Telegram required a wait of {seconds} seconds") seconds += 60 self.logger.info(f"{self.session_name} | Sleep {seconds} seconds") await asyncio.sleep(seconds) web_view = await self.tg_client.invoke( RequestAppWebView( peer=peer, app=InputBotAppShortName(bot_id=peer, short_name="game"), platform="android", write_allowed=True, start_param=config.REF_ID, ) ) tg_web_data = parse_qs(web_view.url.split("#")[1]).get("tgWebAppData")[0] query_params = parse_qs(tg_web_data) return TgWebData( request_data={ "data": { "chatId": "", "chatInstance": tg_web_data, "chatType": query_params.get("chat_type")[0], "initData": tg_web_data, "platform": "android", "startParam": config.REF_ID, }, }, hash=query_params.get("hash")[0], ) except RuntimeError as error: raise error from error except Exception as error: log.error(f"{self.session_name} | Authorization error: {error}") await asyncio.sleep(delay=3) async def join_and_archive_channel(self, channel_name: str) -> None: try: async with self.tg_client: try: chat = await self.tg_client.join_chat(channel_name) self.logger.info(f"Successfully joined to <g>{chat.title}</g> successfully archived") except RPCError: self.logger.error("Channel <y>{channel_name}</y> not found") raise else: await self.sleeper() while True: try: peer = await self.tg_client.resolve_peer(chat.id) break except FloodWait as error: seconds = error.value self.logger.warning(f"{self.session_name} | Telegram required a wait of <ly>{seconds}</ly> seconds") seconds += 60 self.logger.info(f"{self.session_name} | Sleep <ly>{seconds}</ly> seconds") await asyncio.sleep(seconds) until_date = datetime.now() + timedelta( days=365 * 100 ) # Устанавливаем максимальный срок (100 лет от текущей даты) await self.tg_client.set_chat_mute(chat_id=chat.id, until_date=until_date) await self.tg_client.invoke( account.UpdateNotifySettings( peer=InputNotifyPeer(peer=peer), settings=InputPeerNotifySettings(mute_until=2147483647) ) ) self.logger.info(f"Successfully muted chat <g>{chat.title}</g> for channel <y>{channel_name}</y>") await self.sleeper() await self.tg_client.archive_chats(chat_ids=[chat.id]) self.logger.info( f"Channel <g>{chat.title}</g> successfully archived for channel <y>{channel_name}</y>" ) except errors.FloodWait as e: self.logger.error(f"Waiting {e.value} seconds before the next attempt.") await asyncio.sleep(e.value) raise async def sleeper(self, delay: int = config.RANDOM_SLEEP_TIME, additional_delay: int = 4) -> None: await asyncio.sleep(random.random() * delay + additional_delay) @error_handler() @handle_request("/telegram/auth") async def login(self, *, response_json: dict, json_body: dict) -> bool: if response_json.get("success", False): self.logger.success("Login successful") return True return False @error_handler() @handle_request("/dbs", json_body={"data": {"dbs": ["all"]}}) async def get_dbs(self, *, response_json: dict) -> dict: return response_json["data"] @error_handler() @handle_request("/hero/balance/sync", json_body={"data": {}}) async def syn_hero_balance(self, *, response_json: dict) -> Profile: self._update_money_balance(response_json) self.logger.info( f"Level: <blue>{self.level}</blue> | " f"Balance: <y>{num_prettier(self.balance)}</y> | " f"Money per hour: <g>{num_prettier(self.mph)}</g>" ) return Profile(**response_json["data"]) @error_handler() @handle_request("/user/data/all", json_body={"data": {}}) async def get_profile_full(self, *, response_json: dict) -> dict: return dict(**response_json["data"]) @error_handler() @handle_request("/user/data/after", json_body={"data": {"lang": "en"}}) async def user_data_after(self, *, response_json: dict) -> UserDataAfter: return UserDataAfter(**response_json["data"]) @error_handler() @handle_request("/hero/bonus/offline/claim") async def get_offline_bonus(self, *, response_json: dict) -> None: self._update_money_balance(response_json) self.logger.success(f"Offline bonus claimed: <y>+{num_prettier(self.user_profile.offline_bonus)}</y>") @error_handler() @handle_request("/quests/daily/claim") async def daily_reward(self, *, response_json: dict, json_body: dict) -> None: self._update_money_balance(response_json) @error_handler() @handle_request("/quests/claim") async def quest_reward_claim(self, *, response_json: dict, json_body: dict) -> bool: self._update_money_balance(response_json) return True @error_handler() @handle_request("/quests/daily/progress/claim") async def daily_quest_reward(self, *, response_json: dict, json_body: dict) -> None: self._update_money_balance(response_json) @error_handler() @handle_request("/quests/daily/progress/all") async def all_daily_quests(self, *, response_json: dict) -> dict: return response_json["data"] @error_handler() @handle_request("/quests/check") async def quest_check(self, *, response_json: dict, json_body: dict) -> bool: await self.sleeper() await self.quest_reward_claim(json_body=json_body) @error_handler() @handle_request("/friends/claim") async def friend_reward(self, *, response_json: dict, json_body: dict) -> None: self._update_money_balance(response_json) @error_handler() @handle_request("/hero/action/tap") async def api_perform_taps(self, *, response_json: dict, json_body: dict) -> int: if (error_msg := response_json.get("error")) and "take some rest" in error_msg: raise TapsError(error_msg) data = self._update_money_balance(response_json) self.tapped_today = data.get("tappedToday", 0) return int(data["hero"]["earns"]["task"]["energy"]) @cached(ttl=2 * 60 * 60, cache=Cache.MEMORY) @error_handler() @handle_request( "https://raw.githubusercontent.com/testingstrategy/musk_daily/main/daily.json", method="GET", full_url=True, ) async def get_helper(self, *, response_json: str) -> FundHelper | dict: response_json = json.loads(response_json) return FundHelper( funds=response_json.get(str(datetime.now(UTC).date()), {}).get("funds", set()), **response_json, ) @error_handler() @handle_request("/fund/info") async def get_funds_info(self, *, response_json: dict) -> dict: return response_json["data"] @error_handler() @handle_request("/box/list", json_body={}) async def get_box_list(self, *, response_json: dict) -> dict: return response_json["data"] or {} @error_handler() @handle_request("/box/open") async def box_open(self, *, response_json: dict, json_body: dict) -> list: return response_json["data"] @error_handler() @handle_request("/pvp/info") async def get_pvp_info(self, *, response_json: dict) -> dict: return response_json["data"] @error_handler() @handle_request("/pvp/start/fight") async def get_pvp_fight(self, *, response_json: dict, json_body: dict) -> PvpData | None: if response_json["data"].get("opponent"): return PvpData(**response_json["data"]) return None @error_handler() @handle_request("/pvp/claim") async def get_pvp_claim(self, *, response_json: dict) -> None: if response_json.get("success"): self._update_money_balance(response_json) @error_handler() @handle_request( "/settings/save", json_body={ "data": { "id": None, "music": False, "sound": True, "vibrate": True, "animations": True, "darkTheme": True, "lang": "en", } }, ) async def sent_eng_settings(self, *, response_json: dict) -> None: ... @error_handler() @handle_request("/fund/invest") async def invest(self, *, response_json: dict, json_body: dict) -> None: data = self._update_money_balance(response_json) for fnd in data["funds"]: if fnd["fundKey"] == json_body["data"]["fund"]: money = fnd["moneyProfit"] money_str = ( f"Win: <y>+{num_prettier(money)}</y>" if money > 0 else f"Loss: <red>{num_prettier(money)}</red>" ) self.logger.success(f"Invest completed: {money_str}") break @error_handler() @handle_request("/skills/improve") async def skills_improve(self, *, response_json: dict, json_body: dict) -> None: self._update_money_balance(response_json) async def check_proxy(self, proxy: Proxy) -> None: try: response = await self.http_client.get(url="https://httpbin.org/ip", timeout=aiohttp.ClientTimeout(10)) ip = (await response.json()).get("origin") self.logger.info(f"Proxy IP: {ip}") except Exception: self.logger.exception(f"Proxy: {proxy}") def _update_money_balance(self, response_json: dict) -> dict: response_json = response_json["data"] self.balance = int(response_json["hero"]["money"]) self.level = int(response_json["hero"]["level"]) self.mph = int(response_json["hero"]["moneyPerHour"]) return response_json
pro, 319 line right?. Error: IndentationError: expected an indented block after class definition on line 20
no just take the text from this file and replace all of it with your apy.py aa.txt for me that not good 100% but you can try
in api.py file
Pro, i got error after repalce and run with your tips: PS C:\Users\tuan> cd D:\Telebot\MuskEmpireBot-main PS D:\Telebot\MuskEmpireBot-main> python main.py Traceback (most recent call last): File "D:\Telebot\MuskEmpireBot-main\main.py", line 3, in from bot import launcher File "D:\Telebot\MuskEmpireBot-main\bot\launcher.py", line 13, in from bot.core.bot import run_bot File "D:\Telebot\MuskEmpireBot-main\bot\core\bot.py", line 20, in from .api import CryptoBotApi File "D:\Telebot\MuskEmpireBot-main\bot\core\api.py", line 63 try: ^ IndentationError: unindent does not match any outer indentation level
probably because the spaces pase all the api.py file:
import asyncio import json import random from datetime import datetime, timedelta from typing import NamedTuple from urllib.parse import parse_qs
import aiohttp from aiocache import Cache, cached from better_proxy import Proxy from pyrogram import Client, errors from pyrogram.errors import RPCError from pyrogram.raw.functions import account from pyrogram.raw.functions.messages import RequestAppWebView from pyrogram.raw.types import InputBotAppShortName, InputNotifyPeer, InputPeerNotifySettings from pytz import UTC from bot.config.logger import log from bot.config.settings import config from bot.helper.utils import error_handler, handle_request from .errors import TapsError from .models import FundHelper, Profile, ProfileData, PvpData, UserDataAfter from .utils import num_prettier from pyrogram.errors import RPCError,FloodWait class TgWebData(NamedTuple): hash: str request_data: dict class CryptoBotApi: def init(self, tg_client: Client): self.session_name = tg_client.name self.tg_client = tg_client self.user_id = None self.api_url = "https://api.xempire.io" self.need_quiz = False self.need_rebus = False self.rebus_key = "" self.errors = 0 self.logger = log.bind(session_name=self.session_name)
async def get_tg_web_data(self, proxy: str | None) -> TgWebData: if proxy: proxy = Proxy.from_str(proxy) proxy_dict = { "scheme": proxy.protocol, "hostname": proxy.host, "port": proxy.port, "username": proxy.login, "password": proxy.password, } else: proxy_dict = None self.tg_client.proxy = proxy_dict try: async with self.tg_client: while True: try: peer = await self.tg_client.resolve_peer(config.bot_name) break except FloodWait as error: seconds = error.value self.logger.warning(f"{self.session_name} | Telegram required a wait of {seconds} seconds") seconds += 60 self.logger.info(f"{self.session_name} | Sleep {seconds} seconds") await asyncio.sleep(seconds) web_view = await self.tg_client.invoke( RequestAppWebView( peer=peer, app=InputBotAppShortName(bot_id=peer, short_name="game"), platform="android", write_allowed=True, start_param=config.REF_ID, ) ) tg_web_data = parse_qs(web_view.url.split("#")[1]).get("tgWebAppData")[0] query_params = parse_qs(tg_web_data) return TgWebData( request_data={ "data": { "chatId": "", "chatInstance": tg_web_data, "chatType": query_params.get("chat_type")[0], "initData": tg_web_data, "platform": "android", "startParam": config.REF_ID, }, }, hash=query_params.get("hash")[0], ) except RuntimeError as error: raise error from error except Exception as error: log.error(f"{self.session_name} | Authorization error: {error}") await asyncio.sleep(delay=3) async def join_and_archive_channel(self, channel_name: str) -> None: try: async with self.tg_client: try: chat = await self.tg_client.join_chat(channel_name) self.logger.info(f"Successfully joined to <g>{chat.title}</g> successfully archived") except RPCError: self.logger.error("Channel <y>{channel_name}</y> not found") raise else: await self.sleeper() while True: try: peer = await self.tg_client.resolve_peer(chat.id) break except FloodWait as error: seconds = error.value self.logger.warning(f"{self.session_name} | Telegram required a wait of <ly>{seconds}</ly> seconds") seconds += 60 self.logger.info(f"{self.session_name} | Sleep <ly>{seconds}</ly> seconds") await asyncio.sleep(seconds) until_date = datetime.now() + timedelta( days=365 * 100 ) # Устанавливаем максимальный срок (100 лет от текущей даты) await self.tg_client.set_chat_mute(chat_id=chat.id, until_date=until_date) await self.tg_client.invoke( account.UpdateNotifySettings( peer=InputNotifyPeer(peer=peer), settings=InputPeerNotifySettings(mute_until=2147483647) ) ) self.logger.info(f"Successfully muted chat <g>{chat.title}</g> for channel <y>{channel_name}</y>") await self.sleeper() await self.tg_client.archive_chats(chat_ids=[chat.id]) self.logger.info( f"Channel <g>{chat.title}</g> successfully archived for channel <y>{channel_name}</y>" ) except errors.FloodWait as e: self.logger.error(f"Waiting {e.value} seconds before the next attempt.") await asyncio.sleep(e.value) raise async def sleeper(self, delay: int = config.RANDOM_SLEEP_TIME, additional_delay: int = 4) -> None: await asyncio.sleep(random.random() * delay + additional_delay) @error_handler() @handle_request("/telegram/auth") async def login(self, *, response_json: dict, json_body: dict) -> bool: if response_json.get("success", False): self.logger.success("Login successful") return True return False @error_handler() @handle_request("/dbs", json_body={"data": {"dbs": ["all"]}}) async def get_dbs(self, *, response_json: dict) -> dict: return response_json["data"] @error_handler() @handle_request("/hero/balance/sync", json_body={"data": {}}) async def syn_hero_balance(self, *, response_json: dict) -> Profile: self._update_money_balance(response_json) self.logger.info( f"Level: <blue>{self.level}</blue> | " f"Balance: <y>{num_prettier(self.balance)}</y> | " f"Money per hour: <g>{num_prettier(self.mph)}</g>" ) return Profile(**response_json["data"]) @error_handler() @handle_request("/user/data/all", json_body={"data": {}}) async def get_profile_full(self, *, response_json: dict) -> dict: return dict(**response_json["data"]) @error_handler() @handle_request("/user/data/after", json_body={"data": {"lang": "en"}}) async def user_data_after(self, *, response_json: dict) -> UserDataAfter: return UserDataAfter(**response_json["data"]) @error_handler() @handle_request("/hero/bonus/offline/claim") async def get_offline_bonus(self, *, response_json: dict) -> None: self._update_money_balance(response_json) self.logger.success(f"Offline bonus claimed: <y>+{num_prettier(self.user_profile.offline_bonus)}</y>") @error_handler() @handle_request("/quests/daily/claim") async def daily_reward(self, *, response_json: dict, json_body: dict) -> None: self._update_money_balance(response_json) @error_handler() @handle_request("/quests/claim") async def quest_reward_claim(self, *, response_json: dict, json_body: dict) -> bool: self._update_money_balance(response_json) return True @error_handler() @handle_request("/quests/daily/progress/claim") async def daily_quest_reward(self, *, response_json: dict, json_body: dict) -> None: self._update_money_balance(response_json) @error_handler() @handle_request("/quests/daily/progress/all") async def all_daily_quests(self, *, response_json: dict) -> dict: return response_json["data"] @error_handler() @handle_request("/quests/check") async def quest_check(self, *, response_json: dict, json_body: dict) -> bool: await self.sleeper() await self.quest_reward_claim(json_body=json_body) @error_handler() @handle_request("/friends/claim") async def friend_reward(self, *, response_json: dict, json_body: dict) -> None: self._update_money_balance(response_json) @error_handler() @handle_request("/hero/action/tap") async def api_perform_taps(self, *, response_json: dict, json_body: dict) -> int: if (error_msg := response_json.get("error")) and "take some rest" in error_msg: raise TapsError(error_msg) data = self._update_money_balance(response_json) self.tapped_today = data.get("tappedToday", 0) return int(data["hero"]["earns"]["task"]["energy"]) @cached(ttl=2 * 60 * 60, cache=Cache.MEMORY) @error_handler() @handle_request( "https://raw.githubusercontent.com/testingstrategy/musk_daily/main/daily.json", method="GET", full_url=True, ) async def get_helper(self, *, response_json: str) -> FundHelper | dict: response_json = json.loads(response_json) return FundHelper( funds=response_json.get(str(datetime.now(UTC).date()), {}).get("funds", set()), **response_json, ) @error_handler() @handle_request("/fund/info") async def get_funds_info(self, *, response_json: dict) -> dict: return response_json["data"] @error_handler() @handle_request("/box/list", json_body={}) async def get_box_list(self, *, response_json: dict) -> dict: return response_json["data"] or {} @error_handler() @handle_request("/box/open") async def box_open(self, *, response_json: dict, json_body: dict) -> list: return response_json["data"] @error_handler() @handle_request("/pvp/info") async def get_pvp_info(self, *, response_json: dict) -> dict: return response_json["data"] @error_handler() @handle_request("/pvp/start/fight") async def get_pvp_fight(self, *, response_json: dict, json_body: dict) -> PvpData | None: if response_json["data"].get("opponent"): return PvpData(**response_json["data"]) return None @error_handler() @handle_request("/pvp/claim") async def get_pvp_claim(self, *, response_json: dict) -> None: if response_json.get("success"): self._update_money_balance(response_json) @error_handler() @handle_request( "/settings/save", json_body={ "data": { "id": None, "music": False, "sound": True, "vibrate": True, "animations": True, "darkTheme": True, "lang": "en", } }, ) async def sent_eng_settings(self, *, response_json: dict) -> None: ... @error_handler() @handle_request("/fund/invest") async def invest(self, *, response_json: dict, json_body: dict) -> None: data = self._update_money_balance(response_json) for fnd in data["funds"]: if fnd["fundKey"] == json_body["data"]["fund"]: money = fnd["moneyProfit"] money_str = ( f"Win: <y>+{num_prettier(money)}</y>" if money > 0 else f"Loss: <red>{num_prettier(money)}</red>" ) self.logger.success(f"Invest completed: {money_str}") break @error_handler() @handle_request("/skills/improve") async def skills_improve(self, *, response_json: dict, json_body: dict) -> None: self._update_money_balance(response_json) async def check_proxy(self, proxy: Proxy) -> None: try: response = await self.http_client.get(url="https://httpbin.org/ip", timeout=aiohttp.ClientTimeout(10)) ip = (await response.json()).get("origin") self.logger.info(f"Proxy IP: {ip}") except Exception: self.logger.exception(f"Proxy: {proxy}") def _update_money_balance(self, response_json: dict) -> dict: response_json = response_json["data"] self.balance = int(response_json["hero"]["money"]) self.level = int(response_json["hero"]["level"]) self.mph = int(response_json["hero"]["moneyPerHour"]) return response_json
pro, 319 line right?. Error: IndentationError: expected an indented block after class definition on line 20
no just take the text from this file and replace all of it with your apy.py aa.txt for me that not good 100% but you can try
Worked but it's don't do anything:
[0504945571] Waiting for 8 seconds before continuing (required by "contacts.ResolveUsername") 2024-09-09 12:18:52 | WARNING | 68 | 0504945571 | 0504945571 | Telegram required a wait of 262 seconds 2024-09-09 12:18:52 | INFO | 70 | 0504945571 | 0504945571 | Sleep 322 seconds 2024-09-09 12:23:29 | WARNING | 68 | 0507166010 | 0507166010 | Telegram required a wait of 420 seconds 2024-09-09 12:23:29 | INFO | 70 | 0507166010 | 0507166010 | Sleep 480 seconds 2024-09-09 12:24:14 | WARNING | 68 | 0504945571 | 0504945571 | Telegram required a wait of 186 seconds 2024-09-09 12:24:14 | INFO | 70 | 0504945571 | 0504945571 | Sleep 246 seconds
in api.py file
Pro, i got error after repalce and run with your tips: PS C:\Users\tuan> cd D:\Telebot\MuskEmpireBot-main PS D:\Telebot\MuskEmpireBot-main> python main.py Traceback (most recent call last): File "D:\Telebot\MuskEmpireBot-main\main.py", line 3, in from bot import launcher File "D:\Telebot\MuskEmpireBot-main\bot\launcher.py", line 13, in from bot.core.bot import run_bot File "D:\Telebot\MuskEmpireBot-main\bot\core\bot.py", line 20, in from .api import CryptoBotApi File "D:\Telebot\MuskEmpireBot-main\bot\core\api.py", line 63 try: ^ IndentationError: unindent does not match any outer indentation level
probably because the spaces pase all the api.py file:
import asyncio import json import random from datetime import datetime, timedelta from typing import NamedTuple from urllib.parse import parse_qs
import aiohttp from aiocache import Cache, cached from better_proxy import Proxy from pyrogram import Client, errors from pyrogram.errors import RPCError from pyrogram.raw.functions import account from pyrogram.raw.functions.messages import RequestAppWebView from pyrogram.raw.types import InputBotAppShortName, InputNotifyPeer, InputPeerNotifySettings from pytz import UTC from bot.config.logger import log from bot.config.settings import config from bot.helper.utils import error_handler, handle_request from .errors import TapsError from .models import FundHelper, Profile, ProfileData, PvpData, UserDataAfter from .utils import num_prettier from pyrogram.errors import RPCError,FloodWait class TgWebData(NamedTuple): hash: str request_data: dict class CryptoBotApi: def init(self, tg_client: Client): self.session_name = tg_client.name self.tg_client = tg_client self.user_id = None self.api_url = "https://api.xempire.io" self.need_quiz = False self.need_rebus = False self.rebus_key = "" self.errors = 0 self.logger = log.bind(session_name=self.session_name)
async def get_tg_web_data(self, proxy: str | None) -> TgWebData: if proxy: proxy = Proxy.from_str(proxy) proxy_dict = { "scheme": proxy.protocol, "hostname": proxy.host, "port": proxy.port, "username": proxy.login, "password": proxy.password, } else: proxy_dict = None self.tg_client.proxy = proxy_dict try: async with self.tg_client: while True: try: peer = await self.tg_client.resolve_peer(config.bot_name) break except FloodWait as error: seconds = error.value self.logger.warning(f"{self.session_name} | Telegram required a wait of {seconds} seconds") seconds += 60 self.logger.info(f"{self.session_name} | Sleep {seconds} seconds") await asyncio.sleep(seconds) web_view = await self.tg_client.invoke( RequestAppWebView( peer=peer, app=InputBotAppShortName(bot_id=peer, short_name="game"), platform="android", write_allowed=True, start_param=config.REF_ID, ) ) tg_web_data = parse_qs(web_view.url.split("#")[1]).get("tgWebAppData")[0] query_params = parse_qs(tg_web_data) return TgWebData( request_data={ "data": { "chatId": "", "chatInstance": tg_web_data, "chatType": query_params.get("chat_type")[0], "initData": tg_web_data, "platform": "android", "startParam": config.REF_ID, }, }, hash=query_params.get("hash")[0], ) except RuntimeError as error: raise error from error except Exception as error: log.error(f"{self.session_name} | Authorization error: {error}") await asyncio.sleep(delay=3) async def join_and_archive_channel(self, channel_name: str) -> None: try: async with self.tg_client: try: chat = await self.tg_client.join_chat(channel_name) self.logger.info(f"Successfully joined to <g>{chat.title}</g> successfully archived") except RPCError: self.logger.error("Channel <y>{channel_name}</y> not found") raise else: await self.sleeper() while True: try: peer = await self.tg_client.resolve_peer(chat.id) break except FloodWait as error: seconds = error.value self.logger.warning(f"{self.session_name} | Telegram required a wait of <ly>{seconds}</ly> seconds") seconds += 60 self.logger.info(f"{self.session_name} | Sleep <ly>{seconds}</ly> seconds") await asyncio.sleep(seconds) until_date = datetime.now() + timedelta( days=365 * 100 ) # Устанавливаем максимальный срок (100 лет от текущей даты) await self.tg_client.set_chat_mute(chat_id=chat.id, until_date=until_date) await self.tg_client.invoke( account.UpdateNotifySettings( peer=InputNotifyPeer(peer=peer), settings=InputPeerNotifySettings(mute_until=2147483647) ) ) self.logger.info(f"Successfully muted chat <g>{chat.title}</g> for channel <y>{channel_name}</y>") await self.sleeper() await self.tg_client.archive_chats(chat_ids=[chat.id]) self.logger.info( f"Channel <g>{chat.title}</g> successfully archived for channel <y>{channel_name}</y>" ) except errors.FloodWait as e: self.logger.error(f"Waiting {e.value} seconds before the next attempt.") await asyncio.sleep(e.value) raise async def sleeper(self, delay: int = config.RANDOM_SLEEP_TIME, additional_delay: int = 4) -> None: await asyncio.sleep(random.random() * delay + additional_delay) @error_handler() @handle_request("/telegram/auth") async def login(self, *, response_json: dict, json_body: dict) -> bool: if response_json.get("success", False): self.logger.success("Login successful") return True return False @error_handler() @handle_request("/dbs", json_body={"data": {"dbs": ["all"]}}) async def get_dbs(self, *, response_json: dict) -> dict: return response_json["data"] @error_handler() @handle_request("/hero/balance/sync", json_body={"data": {}}) async def syn_hero_balance(self, *, response_json: dict) -> Profile: self._update_money_balance(response_json) self.logger.info( f"Level: <blue>{self.level}</blue> | " f"Balance: <y>{num_prettier(self.balance)}</y> | " f"Money per hour: <g>{num_prettier(self.mph)}</g>" ) return Profile(**response_json["data"]) @error_handler() @handle_request("/user/data/all", json_body={"data": {}}) async def get_profile_full(self, *, response_json: dict) -> dict: return dict(**response_json["data"]) @error_handler() @handle_request("/user/data/after", json_body={"data": {"lang": "en"}}) async def user_data_after(self, *, response_json: dict) -> UserDataAfter: return UserDataAfter(**response_json["data"]) @error_handler() @handle_request("/hero/bonus/offline/claim") async def get_offline_bonus(self, *, response_json: dict) -> None: self._update_money_balance(response_json) self.logger.success(f"Offline bonus claimed: <y>+{num_prettier(self.user_profile.offline_bonus)}</y>") @error_handler() @handle_request("/quests/daily/claim") async def daily_reward(self, *, response_json: dict, json_body: dict) -> None: self._update_money_balance(response_json) @error_handler() @handle_request("/quests/claim") async def quest_reward_claim(self, *, response_json: dict, json_body: dict) -> bool: self._update_money_balance(response_json) return True @error_handler() @handle_request("/quests/daily/progress/claim") async def daily_quest_reward(self, *, response_json: dict, json_body: dict) -> None: self._update_money_balance(response_json) @error_handler() @handle_request("/quests/daily/progress/all") async def all_daily_quests(self, *, response_json: dict) -> dict: return response_json["data"] @error_handler() @handle_request("/quests/check") async def quest_check(self, *, response_json: dict, json_body: dict) -> bool: await self.sleeper() await self.quest_reward_claim(json_body=json_body) @error_handler() @handle_request("/friends/claim") async def friend_reward(self, *, response_json: dict, json_body: dict) -> None: self._update_money_balance(response_json) @error_handler() @handle_request("/hero/action/tap") async def api_perform_taps(self, *, response_json: dict, json_body: dict) -> int: if (error_msg := response_json.get("error")) and "take some rest" in error_msg: raise TapsError(error_msg) data = self._update_money_balance(response_json) self.tapped_today = data.get("tappedToday", 0) return int(data["hero"]["earns"]["task"]["energy"]) @cached(ttl=2 * 60 * 60, cache=Cache.MEMORY) @error_handler() @handle_request( "https://raw.githubusercontent.com/testingstrategy/musk_daily/main/daily.json", method="GET", full_url=True, ) async def get_helper(self, *, response_json: str) -> FundHelper | dict: response_json = json.loads(response_json) return FundHelper( funds=response_json.get(str(datetime.now(UTC).date()), {}).get("funds", set()), **response_json, ) @error_handler() @handle_request("/fund/info") async def get_funds_info(self, *, response_json: dict) -> dict: return response_json["data"] @error_handler() @handle_request("/box/list", json_body={}) async def get_box_list(self, *, response_json: dict) -> dict: return response_json["data"] or {} @error_handler() @handle_request("/box/open") async def box_open(self, *, response_json: dict, json_body: dict) -> list: return response_json["data"] @error_handler() @handle_request("/pvp/info") async def get_pvp_info(self, *, response_json: dict) -> dict: return response_json["data"] @error_handler() @handle_request("/pvp/start/fight") async def get_pvp_fight(self, *, response_json: dict, json_body: dict) -> PvpData | None: if response_json["data"].get("opponent"): return PvpData(**response_json["data"]) return None @error_handler() @handle_request("/pvp/claim") async def get_pvp_claim(self, *, response_json: dict) -> None: if response_json.get("success"): self._update_money_balance(response_json) @error_handler() @handle_request( "/settings/save", json_body={ "data": { "id": None, "music": False, "sound": True, "vibrate": True, "animations": True, "darkTheme": True, "lang": "en", } }, ) async def sent_eng_settings(self, *, response_json: dict) -> None: ... @error_handler() @handle_request("/fund/invest") async def invest(self, *, response_json: dict, json_body: dict) -> None: data = self._update_money_balance(response_json) for fnd in data["funds"]: if fnd["fundKey"] == json_body["data"]["fund"]: money = fnd["moneyProfit"] money_str = ( f"Win: <y>+{num_prettier(money)}</y>" if money > 0 else f"Loss: <red>{num_prettier(money)}</red>" ) self.logger.success(f"Invest completed: {money_str}") break @error_handler() @handle_request("/skills/improve") async def skills_improve(self, *, response_json: dict, json_body: dict) -> None: self._update_money_balance(response_json) async def check_proxy(self, proxy: Proxy) -> None: try: response = await self.http_client.get(url="https://httpbin.org/ip", timeout=aiohttp.ClientTimeout(10)) ip = (await response.json()).get("origin") self.logger.info(f"Proxy IP: {ip}") except Exception: self.logger.exception(f"Proxy: {proxy}") def _update_money_balance(self, response_json: dict) -> dict: response_json = response_json["data"] self.balance = int(response_json["hero"]["money"]) self.level = int(response_json["hero"]["level"]) self.mph = int(response_json["hero"]["moneyPerHour"]) return response_json
pro, 319 line right?. Error: IndentationError: expected an indented block after class definition on line 20
no just take the text from this file and replace all of it with your apy.py aa.txt for me that not good 100% but you can try
Worked but it's don't do anything:
[0504945571] Waiting for 8 seconds before continuing (required by "contacts.ResolveUsername") 2024-09-09 12:18:52 | WARNING | 68 | 0504945571 | 0504945571 | Telegram required a wait of 262 seconds 2024-09-09 12:18:52 | INFO | 70 | 0504945571 | 0504945571 | Sleep 322 seconds 2024-09-09 12:23:29 | WARNING | 68 | 0507166010 | 0507166010 | Telegram required a wait of 420 seconds 2024-09-09 12:23:29 | INFO | 70 | 0507166010 | 0507166010 | Sleep 480 seconds 2024-09-09 12:24:14 | WARNING | 68 | 0504945571 | 0504945571 | Telegram required a wait of 186 seconds 2024-09-09 12:24:14 | INFO | 70 | 0504945571 | 0504945571 | Sleep 246 seconds
yeah thats still not good
2024-09-07 20:42:02 | INFO | 86 | 0504945571 | Wait 11 seconds before start 2024-09-07 20:42:02 | INFO | 86 | 0507166010 | Wait 40 seconds before start 2024-09-07 20:42:02 | INFO | 86 | 0544548116 | Wait 12 seconds before start 2024-09-07 20:42:14 | ERROR | 92 | GLOBAL | 0504945571 | Authorization error: Telegram says: [420 FLOOD_WAIT_X] - A wait of 30 seconds is required (caused by "contacts.ResolveUsername") 2024-09-07 20:42:15 | ERROR | 92 | GLOBAL | 0544548116 | Authorization error: Telegram says: [420 FLOOD_WAIT_X] - A wait of 393 seconds is required (caused by "contacts.ResolveUsername") 2024-09-07 20:42:17 | ERROR | 399 | 0504945571 | Unknown error Traceback (most recent call last):
File "/root/MuskEmpireBot/main.py", line 13, in
asyncio.run(main())
│ │ └ <function main at 0xffffbb8304a0>
│ └ <function run at 0xffffbae99260>
└ <module 'asyncio' from '/root/.pyenv/versions/3.11.0/lib/python3.11/asyncio/init.py'>
File "/root/.pyenv/versions/3.11.0/lib/python3.11/asyncio/runners.py", line 190, in run return runner.run(main) │ │ └ <coroutine object main at 0xffffb848d3c0> │ └ <function Runner.run at 0xffffbad10040> └ <asyncio.runners.Runner object at 0xffffbb6c7cd0> File "/root/.pyenv/versions/3.11.0/lib/python3.11/asyncio/runners.py", line 118, in run return self._loop.run_until_complete(task) │ │ │ └ <Task pending name='Task-1' coro=<main() running at /root/MuskEmpireBot/main.py:8> wait_for=<_GatheringFuture pending cb=[Tas... │ │ └ <function BaseEventLoop.run_until_complete at 0xffffbad0dbc0> │ └ <_UnixSelectorEventLoop running=True closed=False debug=False> └ <asyncio.runners.Runner object at 0xffffbb6c7cd0> File "/root/.pyenv/versions/3.11.0/lib/python3.11/asyncio/base_events.py", line 637, in run_until_complete self.run_forever() │ └ <function BaseEventLoop.run_forever at 0xffffbad0db20> └ <_UnixSelectorEventLoop running=True closed=False debug=False> File "/root/.pyenv/versions/3.11.0/lib/python3.11/asyncio/base_events.py", line 604, in run_forever self._run_once() │ └ <function BaseEventLoop._run_once at 0xffffbad0f920> └ <_UnixSelectorEventLoop running=True closed=False debug=False> File "/root/.pyenv/versions/3.11.0/lib/python3.11/asyncio/base_events.py", line 1909, in _run_once handle._run() │ └ <function Handle._run at 0xffffbae99bc0> └ <Handle Task.task_wakeup()>
File "/root/.pyenv/versions/3.11.0/lib/python3.11/asyncio/events.py", line 80, in _run
self._context.run(self._callback, *self._args)
│ │ │ │ │ └ <member '_args' of 'Handle' objects>
│ │ │ │ └ <Handle Task.task_wakeup()>
│ │ │ └ <member '_callback' of 'Handle' objects>
│ │ └ <Handle Task.task_wakeup()>
│ └ <member '_context' of 'Handle' objects>
└ <Handle Task.task_wakeup()>
File "/root/MuskEmpireBot/bot/launcher.py", line 88, in run_bot_with_delay await run_bot(tg_client=tg_client, proxy=proxy, additional_data=additional_data) │ │ │ └ [{'User-Agent': 'Mozilla/5.0 (iPad; CPU OS 17_0_2 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/17.0 Mobile... │ │ └ None │ └ <pyrogram.client.Client object at 0xffffb8a0fdd0> └ <function run_bot at 0xffffb8dd59e0>
File "/root/MuskEmpireBot/bot/core/bot.py", line 408, in run_bot await CryptoBot(tg_client=tg_client, additional_data=additional_data).run(proxy=proxy) │ │ │ └ None │ │ └ [{'User-Agent': 'Mozilla/5.0 (iPad; CPU OS 17_0_2 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/17.0 Mobile... │ └ <pyrogram.client.Client object at 0xffffb8a0fdd0> └ <class 'bot.core.bot.CryptoBot'>
File "/root/MuskEmpireBot/bot/core/bot.py", line 322, in login_to_app self.http_client.headers["Api-Key"] = tg_web_data.hash