mirror of
https://github.com/Fluffy-Bean/Lynxie.git
synced 2025-05-31 15:53:14 +00:00
Clean up code
This commit is contained in:
parent
90a347eb0b
commit
c359356f4b
10 changed files with 51 additions and 36 deletions
|
@ -1,9 +1,7 @@
|
|||
import os
|
||||
import sys
|
||||
import dotenv
|
||||
|
||||
import discord
|
||||
from discord.gateway import _log
|
||||
from lynxie.config import LYNXIE_PREFIX
|
||||
|
||||
|
||||
async def mobile_status(self):
|
||||
|
@ -53,19 +51,9 @@ def error_message(error: str) -> discord.Embed:
|
|||
title="Error :(",
|
||||
description=error,
|
||||
colour=discord.Colour.red(),
|
||||
).set_footer(
|
||||
text=f"For more information, use the "
|
||||
f"{LYNXIE_PREFIX}help command."
|
||||
)
|
||||
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")
|
||||
if from_file is None:
|
||||
return from_env
|
||||
else:
|
||||
return from_file
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue