diff --git a/.gitignore b/.gitignore index f3d8d4c..0e84f44 100644 --- a/.gitignore +++ b/.gitignore @@ -4,3 +4,4 @@ node_modules/ config.json .vscode +discord.log diff --git a/pvm_highscores.py b/pvm_highscores.py index 25b24d8..568b1ab 100644 --- a/pvm_highscores.py +++ b/pvm_highscores.py @@ -1,19 +1,35 @@ +""" +pvm_highscores discord bot +""" + import json +import logging import discord +logger = logging.getLogger('discord') +logger.setLevel(logging.DEBUG) +handler = logging.FileHandler( + filename='discord.log', encoding='utf-8', mode='w') +handler.setFormatter(logging.Formatter( + '%(asctime)s:%(levelname)s:%(name)s: %(message)s')) +logger.addHandler(handler) + + client = discord.Client() -with open("config.json") as file: +with open("config.json", encoding='utf-8', mode='r') as file: config_data = json.load(file) @client.event async def on_ready(): - print('We have logged in as {0.user}'.format(client)) + """"reports when bot logs in""" + print(f'We have logged in as {client.user}') @client.event async def on_message(message): + """"runs when message is sent on server""" print("message get") if message.author == client.user: return