Added getter for welcome message env variable.

Added a getter function for the welcome message environment variable. Fixes issue #34.
Karl 1 year ago committed by GitHub
parent 0b4ce78557
commit 49b652bdd3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -53,3 +53,21 @@ class EnvService:
allowed_roles.split(",") if "," in allowed_roles else [allowed_roles]
)
return allowed_roles
@staticmethod
def get_welcome_message():
# WELCOME_MESSAGE is a string used to welcome new members to the server.
#The string can be blank.
#The string is DMd to the new server member as part of an embed.
try:
welcome_message = os.getenv("WELCOME_MESSAGE")
except:
welcome_message = None
if welcome_message is None:
raise ValueError(
"WELCOME_MESSAGE is not defined properly in the environment file!"
"Please create a welcome message and put it into WELCOME_MESSAGE in the .env file."
'For example a line should look like: `WELCOME_MESSAGE:"Welcome to our server! We hop you enjoy it here."`'
)
return welcome_message

Loading…
Cancel
Save