From 597d27117c3f990edc5bc53a62b1b2429fdd6330 Mon Sep 17 00:00:00 2001 From: Eriks Karls Date: Tue, 27 Aug 2019 11:16:36 +0300 Subject: [PATCH] Donating money now return status true or false --- erepublik/citizen.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/erepublik/citizen.py b/erepublik/citizen.py index 9b81100..0c6d6e2 100644 --- a/erepublik/citizen.py +++ b/erepublik/citizen.py @@ -1277,9 +1277,11 @@ class Citizen(classes.CitizenAPI): def activate_pp_booster(self, battle_id: int) -> Response: return self._post_military_fight_activate_booster(battle_id, 1, 180, "prestige_points") - def donate_money(self, citizen_id: int = 1620414, amount: float = 0.0, currency: int = 62) -> Response: + def donate_money(self, citizen_id: int = 1620414, amount: float = 0.0, currency: int = 62) -> bool: """ currency: gold = 62, cc = 1 """ - return self._post_economy_donate_money_action(citizen_id, amount, currency) + resp = self._post_economy_donate_money_action(citizen_id, amount, currency) + r = re.search('You do not have enough money in your account to make this donation', resp.text) + return not bool(r) def donate_items(self, citizen_id: int = 1620414, amount: int = 0, industry_id: int = 1, quality: int = 1) -> Response: