Skip to content
This repository has been archived by the owner on Mar 11, 2022. It is now read-only.

Commit

Permalink
small changes
Browse files Browse the repository at this point in the history
  • Loading branch information
Random-guy-on-internet committed Mar 13, 2021
1 parent 6e2af8e commit c3e759a
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
9 changes: 6 additions & 3 deletions Help_functions/bot_functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
from datetime import datetime
from random import choice, randint

from Time_saver.utils import fight395791_
from login import get_content, get_nick_and_pw


Expand Down Expand Up @@ -169,8 +170,8 @@ def convert_to_dict(s):
s_list = s.replace("'", '').split("&")
s_list[0] = f"ip={s_list[0]}"
return dict([a.split("=") for a in s_list])


async def fighting(server, battle_id, side, wep):
URL = f"https://{server}.e-sim.org/"

Expand All @@ -191,9 +192,11 @@ async def fighting(server, battle_id, side, wep):

async def send_fight_request(URL, tree, wep, side, value="Berserk"):
hidden_id = tree.xpath("//*[@id='battleRoundId']")[0].value
fight395791 = fight395791_(tree.text_content())
data = {"weaponQuality": wep, "battleRoundId": hidden_id, "side": side, "value": value}
data.update(convert_to_dict("".join(tree.xpath("//script[3]/text()")).split("&ip=")[1].split(";")[0]))
return await get_content(f"{URL}fight395791.html", data=data)
return await get_content(f"{URL}{fight395791}", data=data)


async def location(server):
"""getting current location"""
Expand Down
6 changes: 6 additions & 0 deletions Time_saver/utils.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import re


def fight395791_(r: str):
fg_re = 'url: (\".*fight.*.html\")'
return re.sub("[\"\']*", "", re.findall(fg_re, r)[0])

0 comments on commit c3e759a

Please sign in to comment.