1
0
Fork 0
mirror of https://github.com/myned/modufur.git synced 2024-12-25 06:37:29 +00:00

utils.config, formatting fix

This commit is contained in:
Myned 2017-10-13 23:38:58 -04:00
parent efd035fce5
commit 70c863062b

View file

@ -17,31 +17,18 @@ from misc import exceptions as exc
from misc import checks from misc import checks
from utils import utils as u 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) logging.basicConfig(level=logging.INFO)
print('PID {}'.format(os.getpid())) 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 # Send and print ready message to #testing and console after logon
@bot.event @bot.event
async def on_ready(): async def on_ready():
bot.add_cog(tools.Utils(bot)) 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(owner.Tools(bot))
bot.add_cog(management.Administration(bot)) bot.add_cog(management.Administration(bot))
bot.add_cog(info.Info(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)) # bot.loop.create_task(u.clear(booru.temp_urls, 30*60))
if isinstance(bot.get_channel(config['startup_channel']), d.TextChannel): if isinstance(bot.get_channel(u.config['startup_channel']), d.TextChannel):
await bot.get_channel(config['startup_channel']).send('**Started.** ☀️') await bot.get_channel(u.config['startup_channel']).send('**Started.** ☀️')
print('CONNECTED') print('CONNECTED')
print(bot.user.name) print(bot.user.name)
print('-------') print('-------')
@ -94,4 +81,4 @@ async def test(ctx):
bot.add_listener(on_reaction_add) bot.add_listener(on_reaction_add)
bot.add_listener(on_reaction_remove) bot.add_listener(on_reaction_remove)
bot.run(config['token']) bot.run(u.config['token'])