AutoPost medals
This commit is contained in:
parent
f294506a2d
commit
aba8c15fd3
@ -261,6 +261,9 @@ class Citizen(CitizenAPI):
|
|||||||
r"<div title=\"(.*?)\">", medal, re.M | re.S)
|
r"<div title=\"(.*?)\">", medal, re.M | re.S)
|
||||||
about = info.group(1).strip()
|
about = info.group(1).strip()
|
||||||
title = info.group(2).strip()
|
title = info.group(2).strip()
|
||||||
|
award_id = re.search(r'"wall_enable_alerts_(\d+)', medal)
|
||||||
|
if award_id:
|
||||||
|
self._post_main_wall_post_automatic(**{'message': title, 'awardId': award_id.group(1)})
|
||||||
reward, currency = info.group(3).strip().split(" ")
|
reward, currency = info.group(3).strip().split(" ")
|
||||||
while not isinstance(reward, float):
|
while not isinstance(reward, float):
|
||||||
try:
|
try:
|
||||||
@ -1337,7 +1340,7 @@ class Citizen(CitizenAPI):
|
|||||||
if not self.get_active_ground_damage_booster():
|
if not self.get_active_ground_damage_booster():
|
||||||
duration = 0
|
duration = 0
|
||||||
for length, amount in self.boosters[50].items():
|
for length, amount in self.boosters[50].items():
|
||||||
if amount > 1:
|
if amount > 2:
|
||||||
duration = length
|
duration = length
|
||||||
break
|
break
|
||||||
if duration:
|
if duration:
|
||||||
|
@ -904,6 +904,10 @@ Class for unifying eRepublik known endpoints and their required/optional paramet
|
|||||||
data = {"_token": self.token, "post_message": body}
|
data = {"_token": self.token, "post_message": body}
|
||||||
return self.post("{}/main/wall-post/create/json".format(self.url), data=data)
|
return self.post("{}/main/wall-post/create/json".format(self.url), data=data)
|
||||||
|
|
||||||
|
def _post_main_wall_post_automatic(self, **kwargs) -> Response:
|
||||||
|
kwargs.update(_token=self.token)
|
||||||
|
return self.post("{}/main/wall-post/create/json".format(self.url), data=kwargs)
|
||||||
|
|
||||||
def _post_main_wall_post_retrieve(self) -> Response:
|
def _post_main_wall_post_retrieve(self) -> Response:
|
||||||
data = {"_token": self.token, "page": 1, "switchedFrom": False}
|
data = {"_token": self.token, "page": 1, "switchedFrom": False}
|
||||||
return self.post("{}/main/wall-post/retrieve/json".format(self.url), data=data)
|
return self.post("{}/main/wall-post/retrieve/json".format(self.url), data=data)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user