diff --git a/erepublik/citizen.py b/erepublik/citizen.py index 0444436..9b81100 100644 --- a/erepublik/citizen.py +++ b/erepublik/citizen.py @@ -1943,3 +1943,14 @@ class Citizen(classes.CitizenAPI): elite = 1.1 if elite else 1 dmg = int(dmg * elite) return dmg * (1.1 if ne else 1.) + + def endorse_article(self, article_id: int, amount: int) -> bool: + if amount in (5, 50, 100): + resp = self._post_main_donate_article(article_id, amount).json() + return not bool(resp.get('error')) + else: + return False + + def vote_article(self, article_id: int) -> bool: + resp = self._post_main_vote_article(article_id).json() + return not bool(resp.get('error')) diff --git a/erepublik/classes.py b/erepublik/classes.py index 8b25a47..9aa380c 100644 --- a/erepublik/classes.py +++ b/erepublik/classes.py @@ -800,6 +800,10 @@ Class for unifying eRepublik known endpoints and their required/optional paramet data = dict(_token=self.token, check=check, **kwargs) return self.post("{}/main/travel".format(self.url), data=data) + def _post_main_vote_article(self, article_id: int) -> Response: + data = dict(_token=self.token, articleId=article_id) + return self.post("{}/main/vote-article".format(self.url), data=data) + def _post_main_travel_data(self, **kwargs) -> Response: return self.post("{}/main/travelData".format(self.url), data=dict(_token=self.token, **kwargs))