mirror of
https://github.com/myned/modufur.git
synced 2024-11-01 21:02:38 +00:00
Fixed config file creation
This commit is contained in:
parent
52648613bf
commit
3d02095687
2 changed files with 24 additions and 22 deletions
|
@ -1,22 +1,12 @@
|
||||||
import asyncio
|
|
||||||
import discord
|
|
||||||
import json
|
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:
|
try:
|
||||||
with open('global_blacklist.json') as infile:
|
with open('global_blacklist.json') as infile:
|
||||||
global_blacklist = json.load(infile)
|
global_blacklist = json.load(infile)
|
||||||
print('\"global_blacklist.json\" loaded.')
|
print('\"global_blacklist.json\" loaded.')
|
||||||
except FileNotFoundError:
|
except FileNotFoundError:
|
||||||
print('Blacklist file not found: \"global_blacklist.json\" created.')
|
|
||||||
with open('global_blacklist.json', 'w+') as iofile:
|
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)
|
json.dump([], iofile, indent=4, sort_keys=True)
|
||||||
iofile.seek(0)
|
iofile.seek(0)
|
||||||
global_blacklist = json.load(iofile)
|
global_blacklist = json.load(iofile)
|
||||||
|
@ -25,8 +15,8 @@ try:
|
||||||
guild_blacklist = json.load(infile)
|
guild_blacklist = json.load(infile)
|
||||||
print('\"guild_blacklist.json\" loaded.')
|
print('\"guild_blacklist.json\" loaded.')
|
||||||
except FileNotFoundError:
|
except FileNotFoundError:
|
||||||
print('Blacklist file not found: \"guild_blacklist.json\" created.')
|
|
||||||
with open('guild_blacklist.json', 'w+') as iofile:
|
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)
|
json.dump({}, iofile, indent=4, sort_keys=True)
|
||||||
iofile.seek(0)
|
iofile.seek(0)
|
||||||
guild_blacklist = json.load(iofile)
|
guild_blacklist = json.load(iofile)
|
||||||
|
@ -35,12 +25,23 @@ try:
|
||||||
user_blacklist = json.load(infile)
|
user_blacklist = json.load(infile)
|
||||||
print('\"user_blacklist.json\" loaded.')
|
print('\"user_blacklist.json\" loaded.')
|
||||||
except FileNotFoundError:
|
except FileNotFoundError:
|
||||||
print('Blacklist file not found: \"user_blacklist.json\" created.')
|
|
||||||
with open('user_blacklist.json', 'w+') as iofile:
|
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)
|
json.dump({}, iofile, indent=4, sort_keys=True)
|
||||||
iofile.seek(0)
|
iofile.seek(0)
|
||||||
user_blacklist = json.load(iofile)
|
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 = {}
|
last_command = {}
|
||||||
|
|
||||||
class MsG:
|
class MsG:
|
||||||
|
|
|
@ -1,12 +1,4 @@
|
||||||
import asyncio
|
|
||||||
import discord
|
|
||||||
import json
|
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:
|
try:
|
||||||
with open('config.json') as infile:
|
with open('config.json') as infile:
|
||||||
|
@ -14,9 +6,18 @@ try:
|
||||||
print('\"config.json\" loaded.')
|
print('\"config.json\" loaded.')
|
||||||
except FileNotFoundError:
|
except FileNotFoundError:
|
||||||
with open('config.json', 'w') as outfile:
|
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.')
|
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')
|
bot = commands.Bot(command_prefix=commands.when_mentioned_or(','), 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
|
||||||
|
|
Loading…
Reference in a new issue