diff --git a/src/main/cogs/booru.py b/src/main/cogs/booru.py index a9faf42..fb335d2 100644 --- a/src/main/cogs/booru.py +++ b/src/main/cogs/booru.py @@ -1,22 +1,12 @@ -import asyncio -import discord import json -import requests -import traceback -from discord import reaction -from discord.ext import commands -from discord.ext.commands import errors -from misc import checks -from misc import exceptions as exc -from utils import formatter, scraper try: with open('global_blacklist.json') as infile: global_blacklist = json.load(infile) print('\"global_blacklist.json\" loaded.') except FileNotFoundError: - print('Blacklist file not found: \"global_blacklist.json\" created.') with open('global_blacklist.json', 'w+') as iofile: + print('Blacklist file not found: \"global_blacklist.json\" created.') json.dump([], iofile, indent=4, sort_keys=True) iofile.seek(0) global_blacklist = json.load(iofile) @@ -25,8 +15,8 @@ try: guild_blacklist = json.load(infile) print('\"guild_blacklist.json\" loaded.') except FileNotFoundError: - print('Blacklist file not found: \"guild_blacklist.json\" created.') with open('guild_blacklist.json', 'w+') as iofile: + print('Blacklist file not found: \"guild_blacklist.json\" created.') json.dump({}, iofile, indent=4, sort_keys=True) iofile.seek(0) guild_blacklist = json.load(iofile) @@ -35,12 +25,23 @@ try: user_blacklist = json.load(infile) print('\"user_blacklist.json\" loaded.') except FileNotFoundError: - print('Blacklist file not found: \"user_blacklist.json\" created.') with open('user_blacklist.json', 'w+') as iofile: + print('Blacklist file not found: \"user_blacklist.json\" created.') json.dump({}, iofile, indent=4, sort_keys=True) iofile.seek(0) user_blacklist = json.load(iofile) +import asyncio +import discord +import requests +import traceback +from discord import reaction +from discord.ext import commands +from discord.ext.commands import errors +from misc import checks +from misc import exceptions as exc +from utils import formatter, scraper + last_command = {} class MsG: diff --git a/src/main/run.py b/src/main/run.py index c96f37f..6c1d7ab 100644 --- a/src/main/run.py +++ b/src/main/run.py @@ -1,12 +1,4 @@ -import asyncio -import discord import json -import traceback -from discord import utils -from discord.ext import commands -from cogs import booru, info, tools -from misc import checks -from misc import exceptions as exc try: with open('config.json') as infile: @@ -14,9 +6,18 @@ try: print('\"config.json\" loaded.') except FileNotFoundError: with open('config.json', 'w') as outfile: - json.dump({'client_id': 'int', 'owner_id': 'int', 'permissions': 'int', 'shutdown_channel': 'int', 'startup_channel': 'int', 'token': 'str'}, outfile, indent=4, sort_keys=True) + json.dump({'client_id': 0, 'owner_id': 0, 'permissions': 0, '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.') +import asyncio +import discord +import traceback +from discord import utils +from discord.ext import commands +from cogs import booru, info, tools +from misc import checks +from misc import exceptions as exc + bot = commands.Bot(command_prefix=commands.when_mentioned_or(','), description='Experimental booru bot') # Send and print ready message to #testing and console after logon