Add animals command

Fix Youtube playback
Add Database file
This commit is contained in:
Michał Gdula 2023-09-08 18:44:04 +01:00
parent d7953e9808
commit 0c1909807a
12 changed files with 623 additions and 126 deletions

28
lynxie/utils.py Normal file
View file

@ -0,0 +1,28 @@
import os
import dotenv
import discord
def error_message(error: str) -> discord.Embed:
print("Error: " + error)
embed = discord.Embed(
title="Error",
description=f"`{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