From 70c863062bdf145a97b9bb411fe3f59e72bd76f7 Mon Sep 17 00:00:00 2001 From: Myned Date: Fri, 13 Oct 2017 23:38:58 -0400 Subject: [PATCH] utils.config, formatting fix --- src/main/run.py | 25 ++++++------------------- 1 file changed, 6 insertions(+), 19 deletions(-) diff --git a/src/main/run.py b/src/main/run.py index 0e4fbc3..eeaa004 100644 --- a/src/main/run.py +++ b/src/main/run.py @@ -17,31 +17,18 @@ from misc import exceptions as exc from misc import checks from utils import utils as u -try: - with open('config.json') as infile: - config = json.load(infile) - print('\"config.json\" loaded.') -except FileNotFoundError: - with open('config.json', 'w') as outfile: - json.dump({'client_id': 0, 'listed_ids': [0], 'owner_id': 0, 'permissions': 126016, 'prefix': ',', - 'shutdown_channel': 0, 'startup_channel': 0, 'token': 'str'}, outfile, indent=4, sort_keys=True) - raise FileNotFoundError( - 'Config file not found: \"config.json\" created with abstract values. Restart \"run.py\" with correct values.') - - logging.basicConfig(level=logging.INFO) print('PID {}'.format(os.getpid())) -bot = commands.Bot(command_prefix=config['prefix'], description='Experimental booru bot') +bot = commands.Bot(command_prefix=u.config['prefix'], description='Experimental booru bot') + # Send and print ready message to #testing and console after logon - - @bot.event async def on_ready(): bot.add_cog(tools.Utils(bot)) - bot.add_cog(owner.Bot(bot, config)) + bot.add_cog(owner.Bot(bot)) bot.add_cog(owner.Tools(bot)) bot.add_cog(management.Administration(bot)) bot.add_cog(info.Info(bot)) @@ -51,8 +38,8 @@ async def on_ready(): # bot.loop.create_task(u.clear(booru.temp_urls, 30*60)) - if isinstance(bot.get_channel(config['startup_channel']), d.TextChannel): - await bot.get_channel(config['startup_channel']).send('**Started.** ☀️') + if isinstance(bot.get_channel(u.config['startup_channel']), d.TextChannel): + await bot.get_channel(u.config['startup_channel']).send('**Started.** ☀️') print('CONNECTED') print(bot.user.name) print('-------') @@ -94,4 +81,4 @@ async def test(ctx): bot.add_listener(on_reaction_add) bot.add_listener(on_reaction_remove) -bot.run(config['token']) +bot.run(u.config['token'])