diff --git a/.env.example b/.env.example new file mode 100644 index 0000000..b68ccf8 --- /dev/null +++ b/.env.example @@ -0,0 +1,4 @@ +DISCORD_TOKEN= +PYTHONPATH=./src +CRYPT_KEY= +LOG_DIR=logs \ No newline at end of file diff --git a/requirements.txt b/requirements.txt index f45785f..9075d8f 100755 --- a/requirements.txt +++ b/requirements.txt @@ -2,5 +2,5 @@ discord.py==1.7.0 python-dotenv==0.15.0 python-dateutil==2.8.1 git+git://github.com/Klemek/miniscord.git -numpy -matplotlib \ No newline at end of file +matplotlib +cryptography \ No newline at end of file diff --git a/src/data_types/frequency.py b/src/data_types/frequency.py index 24d2d8d..6da7354 100644 --- a/src/data_types/frequency.py +++ b/src/data_types/frequency.py @@ -2,7 +2,6 @@ from typing import List from datetime import timedelta import calendar import matplotlib.pyplot as plt -import numpy as np from io import BytesIO import discord import time diff --git a/src/logs/guild_logs.py b/src/logs/guild_logs.py index 886d425..31151ea 100644 --- a/src/logs/guild_logs.py +++ b/src/logs/guild_logs.py @@ -8,28 +8,29 @@ import time import logging import asyncio import threading - +from dotenv import load_dotenv from . import ChannelLogs from utils import code_message, delta, deltas - -LOG_DIR = "logs" -LOG_EXT = ".logz" - current_analysis = [] current_analysis_lock = threading.Lock() - ALREADY_RUNNING = -100 CANCELLED = -200 NO_FILE = -300 -# 5 minutes, assume 'fast' arg -MIN_MODIFICATION_TIME = 5 * 60 -# 30 days, remove log file -MAX_MODIFICATION_TIME = 30 * 24 * 60 * 60 +load_dotenv() +LOG_DIR = os.getenv("LOG_DIR", "logs") +LOG_EXT = os.getenv("LOG_DIR", ".logz") +CRYPT_KEY = os.getenv("CRYPT_KEY", "") + +# 5 minutes, assume 'fast' arg +MIN_MODIFICATION_TIME = int(os.getenv("MAX_MODIFICATION_TIME", 5 * 60)) + +# 30 days, remove log file +MAX_MODIFICATION_TIME = int(os.getenv("MAX_MODIFICATION_TIME", 30 * 24 * 60 * 60)) class Worker: def __init__(