Code cleanup and logging improvements

doc_update
Joey Hines 2018-08-12 14:00:04 -05:00
parent 6662c018a6
commit 7699d00fa9
15 changed files with 41 additions and 28 deletions

View File

@ -1,5 +1,5 @@
import configparser
import codecs import codecs
import configparser
def create_config(config): def create_config(config):

View File

@ -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 import enum
from difflib import SequenceMatcher 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 BotErrors import *
from MinecraftAccountInfoGrabber import * from MinecraftAccountInfoGrabber import *
SQL_Base = declarative_base() SQL_Base = declarative_base()

View File

@ -1,4 +1,5 @@
from itertools import zip_longest from itertools import zip_longest
from BotConfig import bot_config from BotConfig import bot_config

View File

@ -6,9 +6,10 @@ Created by: Joey Hines (ZeroHD)
""" """
import logging import logging
import logging.handlers as handlers import logging.handlers as handlers
from sys import stdout
import bot import bot
from BotConfig import bot_config from BotConfig import bot_config
from sys import stdout
def setup_logging(): def setup_logging():

View File

@ -1,5 +1,7 @@
import requests
from json import JSONDecodeError from json import JSONDecodeError
import requests
from BotErrors import UsernameLookupFailed from BotErrors import UsernameLookupFailed
uuid_lookup_url = 'https://api.mojang.com/users/profiles/minecraft/{}' uuid_lookup_url = 'https://api.mojang.com/users/profiles/minecraft/{}'

20
bot.py
View File

@ -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 asyncio
import logging 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__) logger = logging.getLogger(__name__)
description = ''' description = '''
@ -38,6 +41,9 @@ extensions = ['cogs.Add_Commands',
@bot.event @bot.event
async def on_ready(): async def on_ready():
logger.info("%s Online, ID: %s", bot.user.name, bot.user.id) 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)) await bot.change_presence(game=Game(name=bot_config.status))

View File

@ -1,4 +1,5 @@
from discord.ext import commands from discord.ext import commands
from BotErrors import * from BotErrors import *
from DiscordHelperFunctions import * from DiscordHelperFunctions import *
from bot import bot_commands from bot import bot_commands

View File

@ -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 import Game
from discord.ext import commands
from BotConfig import bot_config
from BotErrors import *
from bot import bot_commands
def check_mod(user): def check_mod(user):

View File

@ -1,4 +1,5 @@
from discord.ext import commands from discord.ext import commands
from BotErrors import * from BotErrors import *
from DiscordHelperFunctions import * from DiscordHelperFunctions import *
from bot import bot_commands from bot import bot_commands

View File

@ -1,4 +1,5 @@
from discord.ext import commands from discord.ext import commands
from BotErrors import * from BotErrors import *
from DiscordHelperFunctions import * from DiscordHelperFunctions import *
from bot import bot_commands from bot import bot_commands

View File

@ -1,4 +1,5 @@
from discord.ext import commands from discord.ext import commands
from BotErrors import * from BotErrors import *
from DiscordHelperFunctions import * from DiscordHelperFunctions import *
from bot import bot_commands from bot import bot_commands

View File

@ -1,7 +1,6 @@
from unittest import TestCase from unittest import TestCase
from Commands import * from Commands import *
from BotErrors import *
from BotConfig import *
class TestCommands(TestCase): class TestCommands(TestCase):

View File

@ -1,8 +1,6 @@
from unittest import TestCase from unittest import TestCase
from Commands import *
from BotErrors import * from DatabaseInterface import *
from MinecraftAccountInfoGrabber import *
from BotConfig import bot_config
class TestGeoffreyDatabase(TestCase): class TestGeoffreyDatabase(TestCase):

View File

@ -1,4 +1,5 @@
from unittest import TestCase from unittest import TestCase
from DiscordHelperFunctions import get_nickname from DiscordHelperFunctions import get_nickname

View File

@ -1,6 +1,6 @@
from unittest import TestCase from unittest import TestCase
from MinecraftAccountInfoGrabber import * from MinecraftAccountInfoGrabber import *
from BotErrors import UsernameLookupFailed
class TestMinecraftInfoGrabber(TestCase): class TestMinecraftInfoGrabber(TestCase):