diff options
| -rw-r--r-- | main.py | 14 |
1 files changed, 7 insertions, 7 deletions
@@ -3,6 +3,7 @@ import pymongo import discord import asyncio import threading +import logging import parsedatetime import datetime @@ -18,13 +19,10 @@ cli = discord.Client() @cli.event async def on_ready(): - print("Logged in as") - print(cli.user.name) - print(cli.user.id) - print("-----") + log.warning("Logged in as " + cli.user.name + " (" + str(cli.user.id) + ")") def cleanup(): - print("purging old data from database") + log.warning("purging old data from database") now = datetime.datetime.utcnow() db.usercache.remove({ "date": {"$lt": now - datetime.timedelta(minutes=30)} @@ -72,7 +70,7 @@ async def search_teammates(who, query): "end": end }) - print(who.name + " requested a game " + ", ".join([str(d) for d in (start, end)])) + log.debug(who.name + " requested a game " + ", ".join([str(d) for d in (start, end)])) players = [] for teammate in db.playwithme.find({"end": {"$gt": start, "$lt": end}}): @@ -112,7 +110,7 @@ async def on_message(message): # if msg.startswith("\\getrole play"): # toggles the "play" role - print("toggled " + message.author.name + "'s play role") + log.debug("toggled " + message.author.name + "'s play role") for role in message.author.roles: if role.name == "play": await cli.remove_roles(message.author, role) @@ -125,5 +123,7 @@ async def on_message(message): await cli.send_message(message.channel, "Added the 'play' role.") if __name__ == '__main__': + logging.basicConfig() + log = logging.getLogger() threading.Timer(10 * 60, cleanup).start() cli.run(TOKEN) |
