Code cleanup and logging improvements
parent
6662c018a6
commit
7699d00fa9
|
@ -1,5 +1,5 @@
|
|||
import configparser
|
||||
import codecs
|
||||
import configparser
|
||||
|
||||
|
||||
def create_config(config):
|
||||
|
|
|
@ -1,16 +1,16 @@
|
|||
from sqlalchemy import Column, Integer, String, ForeignKey, Enum, create_engine, exists
|
||||
from sqlalchemy.orm import relationship, column_property, sessionmaker
|
||||
from sqlalchemy.exc import IntegrityError, DataError
|
||||
from sqlalchemy.ext.declarative import declarative_base
|
||||
from sqlalchemy.sql import expression
|
||||
import enum
|
||||
from difflib import SequenceMatcher
|
||||
from BotConfig import bot_config
|
||||
|
||||
from sqlalchemy import Column, Integer, String, ForeignKey, Enum, create_engine, exists
|
||||
from sqlalchemy.exc import IntegrityError, DataError
|
||||
from sqlalchemy.ext.declarative import declarative_base
|
||||
from sqlalchemy.orm import relationship, column_property, sessionmaker
|
||||
from sqlalchemy.sql import expression
|
||||
|
||||
from BotConfig import bot_config
|
||||
from BotErrors import *
|
||||
from MinecraftAccountInfoGrabber import *
|
||||
|
||||
|
||||
SQL_Base = declarative_base()
|
||||
|
||||
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
from itertools import zip_longest
|
||||
|
||||
from BotConfig import bot_config
|
||||
|
||||
|
||||
|
|
|
@ -6,9 +6,10 @@ Created by: Joey Hines (ZeroHD)
|
|||
"""
|
||||
import logging
|
||||
import logging.handlers as handlers
|
||||
from sys import stdout
|
||||
|
||||
import bot
|
||||
from BotConfig import bot_config
|
||||
from sys import stdout
|
||||
|
||||
|
||||
def setup_logging():
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
import requests
|
||||
from json import JSONDecodeError
|
||||
|
||||
import requests
|
||||
|
||||
from BotErrors import UsernameLookupFailed
|
||||
|
||||
uuid_lookup_url = 'https://api.mojang.com/users/profiles/minecraft/{}'
|
||||
|
|
20
bot.py
20
bot.py
|
@ -1,13 +1,16 @@
|
|||
from BotErrors import *
|
||||
from DatabaseModels import Player
|
||||
from Commands import Commands
|
||||
from discord.ext import commands
|
||||
from discord import Game
|
||||
from MinecraftAccountInfoGrabber import *
|
||||
from BotConfig import *
|
||||
import asyncio
|
||||
import logging
|
||||
|
||||
from discord import Game
|
||||
from discord.ext import commands
|
||||
from discord.utils import oauth_url
|
||||
|
||||
from BotConfig import *
|
||||
from BotErrors import *
|
||||
from Commands import Commands
|
||||
from DatabaseModels import Player
|
||||
from MinecraftAccountInfoGrabber import *
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
description = '''
|
||||
|
@ -38,6 +41,9 @@ extensions = ['cogs.Add_Commands',
|
|||
@bot.event
|
||||
async def on_ready():
|
||||
logger.info("%s Online, ID: %s", bot.user.name, bot.user.id)
|
||||
info = await bot.application_info()
|
||||
url = oauth_url(info.id)
|
||||
logger.info("Bot url: %s", url)
|
||||
await bot.change_presence(game=Game(name=bot_config.status))
|
||||
|
||||
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
from discord.ext import commands
|
||||
|
||||
from BotErrors import *
|
||||
from DiscordHelperFunctions import *
|
||||
from bot import bot_commands
|
||||
|
|
|
@ -1,8 +1,9 @@
|
|||
from discord.ext import commands
|
||||
from BotErrors import *
|
||||
from BotConfig import bot_config
|
||||
from bot import bot_commands
|
||||
from discord import Game
|
||||
from discord.ext import commands
|
||||
|
||||
from BotConfig import bot_config
|
||||
from BotErrors import *
|
||||
from bot import bot_commands
|
||||
|
||||
|
||||
def check_mod(user):
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
from discord.ext import commands
|
||||
|
||||
from BotErrors import *
|
||||
from DiscordHelperFunctions import *
|
||||
from bot import bot_commands
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
from discord.ext import commands
|
||||
|
||||
from BotErrors import *
|
||||
from DiscordHelperFunctions import *
|
||||
from bot import bot_commands
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
from discord.ext import commands
|
||||
|
||||
from BotErrors import *
|
||||
from DiscordHelperFunctions import *
|
||||
from bot import bot_commands
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
from unittest import TestCase
|
||||
|
||||
from Commands import *
|
||||
from BotErrors import *
|
||||
from BotConfig import *
|
||||
|
||||
|
||||
class TestCommands(TestCase):
|
||||
|
|
|
@ -1,8 +1,6 @@
|
|||
from unittest import TestCase
|
||||
from Commands import *
|
||||
from BotErrors import *
|
||||
from MinecraftAccountInfoGrabber import *
|
||||
from BotConfig import bot_config
|
||||
|
||||
from DatabaseInterface import *
|
||||
|
||||
|
||||
class TestGeoffreyDatabase(TestCase):
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
from unittest import TestCase
|
||||
|
||||
from DiscordHelperFunctions import get_nickname
|
||||
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
from unittest import TestCase
|
||||
|
||||
from MinecraftAccountInfoGrabber import *
|
||||
from BotErrors import UsernameLookupFailed
|
||||
|
||||
|
||||
class TestMinecraftInfoGrabber(TestCase):
|
||||
|
|
Loading…
Reference in New Issue