Skip to content

Commit

Permalink
Fixed bot crashing on new config and no more closing to change config
Browse files Browse the repository at this point in the history
Its no longer required to restart the bot after adding a new app id.

Fixed bot crashing if new app config was generated.
  • Loading branch information
Official-Husko committed May 20, 2022
1 parent fa0b042 commit 8179fe4
Showing 1 changed file with 14 additions and 13 deletions.
27 changes: 14 additions & 13 deletions bot.py
Original file line number Diff line number Diff line change
Expand Up @@ -531,22 +531,23 @@ def downloader(cfg):

# Check if the stormworks_config.ini exists else create it
def check_config(cfg):
cfg2 = configparser.RawConfigParser()
if not os.path.exists("configs/" + config_names.get(game) + "_config.ini"):
cfg.add_section('Default')
cfg.set('Default', '# Enter the Path to the games mod folder', '')
cfg.set('Default', 'ModsPath', 'insert-path-here')
cfg.set('Default', '# if proxies should be scraped and used', '')
cfg.set('Default', 'Proxies', 'yes')
cfg.set('Default', '# Randomize User Agent', '')
cfg.set('Default', 'RandomUserAgent', 'yes')
cfg.set('Default', '# Request Timeout', '')
cfg.set('Default', 'TimeOut', '10')
cfg2.add_section('Default')
cfg2.set('Default', '# Enter the Path to the games mod folder', '')
cfg2.set('Default', 'ModsPath', 'insert-path-here')
cfg2.set('Default', '# if proxies should be scraped and used', '')
cfg2.set('Default', 'Proxies', 'yes')
cfg2.set('Default', '# Randomize User Agent', '')
cfg2.set('Default', 'RandomUserAgent', 'yes')
cfg2.set('Default', '# Request Timeout', '')
cfg2.set('Default', 'TimeOut', '10')
with open(r"configs/" + config_names.get(game) + "_config.ini", 'w') as configfile:
cfg.write(configfile)
cfg2.write(configfile)
configfile.close()
print("New Config file was generated! Please configure it and then start the bot again")
sleep(5)
sys.exit(0)
print("New Config file was generated! Please configure it and then enter the App ID again.")
sleep(3)
game_selection(cfg)
config(cfg)

# Checks for a global app config
Expand Down

0 comments on commit 8179fe4

Please sign in to comment.