mirror of
https://github.com/Fluffy-Bean/Lynxie.git
synced 2025-07-06 16:26:21 +00:00
Add animals command
Fix Youtube playback Add Database file
This commit is contained in:
parent
d7953e9808
commit
0c1909807a
12 changed files with 623 additions and 126 deletions
28
lynxie/utils.py
Normal file
28
lynxie/utils.py
Normal 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
|
Loading…
Add table
Add a link
Reference in a new issue