m3talstorm / foe-bot

:robot: A simple bot to automate the main functions of Forge of Empires (FoE)
MIT License
46 stars 15 forks source link

Collecting from tavern when it isn't yet researched fails #8

Closed LordMike closed 6 years ago

LordMike commented 7 years ago

On a new account, the bot will fail pretty quickly, with:

$ python main.py
Deploy: Dropped database
Deploy: Initialized database
Deploy: Committing to database...
Deploy: Committed to database in 0.00s
Account None (None) fetching...
Account ****** (******) fetched in 0.67s
Players: 86
Buildings: 12
Taverns: 1
Money: 1,526
Supplies: 1,547
Traceback (most recent call last):
  File "main.py", line 54, in <module>
    Tavern.collect()
  File "/mnt/c/Users/Mike/Downloads/a/foe-bot/foe/models/tavern.py", line 112, in collect
    if tavern['view']['visitors']:
KeyError: 'view'

As I understand it, I have to research the tavern first.. :P

On the bright side, I can disable tavern collection in the config :) (+1 for good design)

m3talstorm commented 7 years ago

Ha I never tested the bot on an account that doesn't have a tavern, good find :)

I'll try and add a fix at some point but its low priority, and yes, for the meantime disable collection in config :)

LordMike commented 7 years ago

I researched tavern and re-enabled ... All good :P