mirror of
https://github.com/myned/modufur.git
synced 2024-11-01 13:02:38 +00:00
Merge branch 'dev'
This commit is contained in:
commit
7267d075ee
3 changed files with 19 additions and 18 deletions
|
@ -35,7 +35,7 @@ class Bot:
|
|||
await u.session.close()
|
||||
await self.bot.logout()
|
||||
await self.bot.close()
|
||||
print('-------')
|
||||
print('- - - - - - -')
|
||||
print('CLOSED')
|
||||
|
||||
@commands.command(name=',restart', aliases=[',res', ',r'], hidden=True)
|
||||
|
@ -43,7 +43,7 @@ class Bot:
|
|||
@checks.del_ctx()
|
||||
async def restart(self, ctx):
|
||||
print('RESTARTING')
|
||||
print('-------')
|
||||
print('- - - - - - -')
|
||||
if isinstance(self.bot.get_channel(u.config['startup_channel']), d.TextChannel):
|
||||
await self.bot.get_channel(u.config['shutdown_channel']).send('**Restarting...** 💤')
|
||||
# loop = self.bot.loop.all_tasks()
|
||||
|
|
|
@ -2,7 +2,6 @@ import asyncio
|
|||
import datetime as dt
|
||||
import json
|
||||
import logging
|
||||
import os
|
||||
import subprocess
|
||||
import sys
|
||||
import traceback as tb
|
||||
|
@ -12,21 +11,20 @@ import discord as d
|
|||
from discord import utils
|
||||
from discord.ext import commands
|
||||
|
||||
from cogs import booru, info, management, owner, tools
|
||||
from misc import exceptions as exc
|
||||
from misc import checks
|
||||
from utils import utils as u
|
||||
|
||||
logging.basicConfig(level=logging.INFO)
|
||||
|
||||
print('PID {}'.format(os.getpid()))
|
||||
|
||||
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():
|
||||
from cogs import booru, info, management, owner, tools
|
||||
|
||||
bot.add_cog(tools.Utils(bot))
|
||||
bot.add_cog(owner.Bot(bot))
|
||||
bot.add_cog(owner.Tools(bot))
|
||||
|
@ -42,7 +40,7 @@ async def on_ready():
|
|||
await bot.get_channel(u.config['startup_channel']).send('**Started.** ☀️')
|
||||
print('CONNECTED')
|
||||
print(bot.user.name)
|
||||
print('-------')
|
||||
print('- - - - - - -')
|
||||
|
||||
|
||||
@bot.event
|
||||
|
|
|
@ -1,9 +1,23 @@
|
|||
import asyncio
|
||||
import json
|
||||
import os
|
||||
import pickle as pkl
|
||||
|
||||
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):
|
||||
try:
|
||||
|
@ -30,17 +44,6 @@ def dump(obj, filename):
|
|||
|
||||
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):
|
||||
if replace is None:
|
||||
|
|
Loading…
Reference in a new issue