Updated get_welcome_message function

Updated the get_welcome_message function to fall back on a string saved in a .env file and then to fall back on a simple default string.
Karl 1 year ago committed by GitHub
parent f30c9f07e3
commit 3a663c244f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -56,18 +56,11 @@ class EnvService:
@staticmethod
def get_welcome_message():
# WELCOME_MESSAGE is a string used to welcome new members to the server.
#The string can be blank.
# WELCOME_MESSAGE is a default string used to welcome new members to the server if GPT3 is not available.
#The string can be blank but this is not advised. If a string cannot be found in the .env file, the below string is used.
#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
welcome_message = "Hi there! Welcome to our Discord server!"
return welcome_message

Loading…
Cancel
Save