Revert "Cleanup"

This reverts commit 78d9b9e307.
This commit is contained in:
Logan Cusano
2022-03-16 01:24:23 -04:00
parent 56ee57e96a
commit 1f30e05e46
2 changed files with 15 additions and 18 deletions

1
bot.py
View File

@@ -2,6 +2,7 @@ import asyncio
import os
import platform
import discord
import BotResources
import sound
import configparser

32
main.py
View File

@@ -27,21 +27,18 @@ class BotDeviceNotFound(Exception):
def main(**passed_config):
# Don't create a config if the user passed parameters
if len(passed_config.keys()) == 0:
print('Checking config file...')
if not check_if_config_exists():
print("No config file exists, please enter this information now")
write_config_file(init=True)
print('Checking config file...')
if not check_if_config_exists():
print("No config file exists, please enter this information now")
write_config_file(init=True)
config = read_config_file()
# Overwrite config options if they were passed
if len(passed_config.keys()) == 0:
for sub in config:
# checking if key present in other dictionary
if sub in passed_config and passed_config[sub]:
config[sub] = passed_config[sub]
for sub in config:
# checking if key present in other dictionary
if sub in passed_config and passed_config[sub]:
config[sub] = passed_config[sub]
print('Starting Bot...')
@@ -109,21 +106,20 @@ def cmd_arguments():
return args
if __name__ == '__main__':
cmd_args = cmd_arguments()
args = cmd_arguments()
if not all(cmd_args.values()):
if not all(args.values()):
print("Passed arguments:")
for arg in cmd_args:
if cmd_args[arg]:
print(f"\t{arg}:\t{cmd_args[arg]}")
for arg in args:
if args[arg]:
print(f"\t{arg}:\t{args[arg]}")
try:
print('Starting...')
while True:
try:
main(**cmd_args)
main(**args)
except BotDeviceNotFound:
print("Restarting...")
time.sleep(2)