Fix line length, use os.path.join and other small things
This commit is contained in:
@ -7,8 +7,9 @@ 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."
|
||||
"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()
|
||||
@ -19,7 +20,7 @@ class Settings:
|
||||
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.
|
||||
# Remove trailing slash from domain
|
||||
if domain.endswith("/"):
|
||||
domain = domain[:-1]
|
||||
|
||||
@ -27,12 +28,12 @@ class Settings:
|
||||
try:
|
||||
upload_folder = os.environ["UPLOAD_FOLDER"]
|
||||
except KeyError:
|
||||
sys.exit("discord-embed: Environment variable 'UPLOAD_FOLDER' is missing!")
|
||||
sys.exit("Environment variable 'UPLOAD_FOLDER' is missing!")
|
||||
|
||||
# Create upload_folder if it doesn't exist.
|
||||
pathlib.Path(upload_folder).mkdir(parents=True, exist_ok=True)
|
||||
|
||||
# We check if the upload folder ends with a forward slash. If it does, we remove it.
|
||||
# Remove trailing slash from upload_folder
|
||||
if upload_folder.endswith("/"):
|
||||
upload_folder = upload_folder[:-1]
|
||||
|
||||
@ -40,6 +41,4 @@ class Settings:
|
||||
try:
|
||||
webhook_url = os.environ["WEBHOOK_URL"]
|
||||
except KeyError:
|
||||
sys.exit(
|
||||
"Environment variable 'WEBHOOK_URL' is missing! You may have to restart your terminal or IDE to set it."
|
||||
)
|
||||
sys.exit("Environment variable 'WEBHOOK_URL' is missing!")
|
||||
|
Reference in New Issue
Block a user