Move files to folders

This commit is contained in:
2022-01-03 20:40:02 +01:00
parent 1e0da31c99
commit d060c67197
6 changed files with 27 additions and 29 deletions

39
discord_embed/settings.py Normal file
View File

@ -0,0 +1,39 @@
import os
import sys
from dotenv import load_dotenv
class Settings:
description = (
"Discord will only create embeds for videos and images if they are smaller than 8 mb. We can 'abuse' this"
" by creating a .html that contains the 'twitter:player' HTML meta tag linking to the video."
)
# Load environment variables
load_dotenv()
# Check if user has added a domain to the environment.
try:
domain = os.environ["DOMAIN"]
except KeyError:
sys.exit("discord-embed: Environment variable 'DOMAIN' is missing!")
# We check if the domain ends with a forward slash. If it does, we remove it.
if domain.endswith("/"):
domain = domain[:-1]
# Check if we have a folder for uploads.
try:
upload_folder = os.environ["UPLOAD_FOLDER"]
except KeyError:
sys.exit("discord-embed: Environment variable 'UPLOAD_FOLDER' is missing!")
# We check if the upload folder ends with a forward slash. If it does, we remove it.
if upload_folder.endswith("/"):
upload_folder = upload_folder[:-1]
# Discord webhook URL
try:
webhook_url = os.environ["WEBHOOK_URL"]
except KeyError:
sys.exit("discord-embed: Environment variable 'WEBHOOK_URL' is missing!")