mirror of
https://github.com/myned/modufur.git
synced 2024-12-25 06:37:29 +00:00
Formatting, startup logic changes
This commit is contained in:
parent
a9178b0204
commit
0777573193
3 changed files with 19 additions and 18 deletions
|
@ -2,7 +2,6 @@ import asyncio
|
||||||
import datetime as dt
|
import datetime as dt
|
||||||
import json
|
import json
|
||||||
import logging
|
import logging
|
||||||
import os
|
|
||||||
import subprocess
|
import subprocess
|
||||||
import sys
|
import sys
|
||||||
import traceback as tb
|
import traceback as tb
|
||||||
|
@ -12,21 +11,20 @@ import discord as d
|
||||||
from discord import utils
|
from discord import utils
|
||||||
from discord.ext import commands
|
from discord.ext import commands
|
||||||
|
|
||||||
from cogs import booru, info, management, owner, tools
|
|
||||||
from misc import exceptions as exc
|
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
|
||||||
|
|
||||||
logging.basicConfig(level=logging.INFO)
|
logging.basicConfig(level=logging.INFO)
|
||||||
|
|
||||||
print('PID {}'.format(os.getpid()))
|
|
||||||
|
|
||||||
bot = commands.Bot(command_prefix=u.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():
|
||||||
|
from cogs import booru, info, management, owner, tools
|
||||||
|
|
||||||
bot.add_cog(tools.Utils(bot))
|
bot.add_cog(tools.Utils(bot))
|
||||||
bot.add_cog(owner.Bot(bot))
|
bot.add_cog(owner.Bot(bot))
|
||||||
bot.add_cog(owner.Tools(bot))
|
bot.add_cog(owner.Tools(bot))
|
||||||
|
|
|
@ -1,9 +1,23 @@
|
||||||
import asyncio
|
import asyncio
|
||||||
import json
|
import json
|
||||||
|
import os
|
||||||
import pickle as pkl
|
import pickle as pkl
|
||||||
|
|
||||||
import aiohttp as aio
|
import aiohttp as aio
|
||||||
|
|
||||||
|
print('PID {}'.format(os.getpid()))
|
||||||
|
|
||||||
|
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.')
|
||||||
|
|
||||||
|
|
||||||
def setdefault(filename, default=None):
|
def setdefault(filename, default=None):
|
||||||
try:
|
try:
|
||||||
|
@ -30,17 +44,6 @@ def dump(obj, filename):
|
||||||
|
|
||||||
tasks = setdefault('./cogs/tasks.pkl', {})
|
tasks = setdefault('./cogs/tasks.pkl', {})
|
||||||
|
|
||||||
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.')
|
|
||||||
|
|
||||||
|
|
||||||
async def clear(obj, interval=10 * 60, replace=None):
|
async def clear(obj, interval=10 * 60, replace=None):
|
||||||
if replace is None:
|
if replace is None:
|
||||||
|
|
Loading…
Reference in a new issue