Donation rate limit
This commit is contained in:
parent
49726b8cec
commit
d95c472ede
@ -5,7 +5,7 @@
|
||||
__author__ = """Eriks Karls"""
|
||||
__email__ = 'eriks@72.lv'
|
||||
__version__ = '0.20.0'
|
||||
__commit_id__ = "9a0cbf7"
|
||||
__commit_id__ = "49726b8"
|
||||
|
||||
from erepublik import classes, utils
|
||||
from erepublik.citizen import Citizen
|
||||
|
@ -1139,11 +1139,16 @@ class CitizenEconomy(CitizenTravel):
|
||||
response = self._post_economy_donate_items_action(citizen_id, amount, industry_id, quality)
|
||||
if re.search(rf"Successfully transferred {amount} item\(s\) to", response.text):
|
||||
return amount
|
||||
elif re.search('You must wait 5 seconds before donating again', response.text):
|
||||
self.write_log(f"Previous donation failed! Must wait at least 5 seconds before next donation!")
|
||||
self.sleep(5)
|
||||
return self.donate_items(citizen_id, int(amount), industry_id, quality)
|
||||
else:
|
||||
if re.search(r"You do not have enough items in your inventory to make this donation", response.text):
|
||||
return 0
|
||||
available = re.search(rf"Cannot transfer the items because the user has only (\d+) free slots in (his|her) "
|
||||
rf"storage.", response.text).group(1)
|
||||
self.sleep(5)
|
||||
return self.donate_items(citizen_id, int(available), industry_id, quality)
|
||||
|
||||
def contribute_cc_to_country(self, amount=0., country_id: int = 71) -> bool:
|
||||
|
Loading…
x
Reference in New Issue
Block a user