Lynxie/lynxie/utils.py
Fluffy-Bean 4e685393de Add Images command
Clean up Animals command
2023-09-08 21:53:33 +01:00

28 lines
662 B
Python

import os
import dotenv
import discord
def error_message(error: str) -> discord.Embed:
print("Error: " + error)
embed = discord.Embed(
title="Error :(",
description=error,
colour=discord.Colour.red(),
)
embed.set_footer(text="For more information, use the help command.")
return embed
def get_env_or_error(env: str) -> str:
from_file = dotenv.dotenv_values(".env").get(env)
from_env = os.environ.get(env)
if from_file is None and from_env is None:
raise KeyError(f"Environment variable {env} not found")
elif from_file is None:
return from_env
else:
return from_file