Skip to content

Commit

Permalink
breaking up config
Browse files Browse the repository at this point in the history
  • Loading branch information
coillteoir committed May 8, 2024
1 parent ec6bb02 commit eabc02b
Show file tree
Hide file tree
Showing 3 changed files with 87 additions and 80 deletions.
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
token
config/leaderboards/
**/__pycache__/
nohup.out
Expand Down
24 changes: 14 additions & 10 deletions bot/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,21 +21,25 @@
client = discord.Client(intents=intents)

# Get the configuration
with open("config/configuration_data.json", "r", encoding="utf-8") as config_file:
configuration_data = json.loads(config_file.read())
def load_config():
with open("config/configuration_data.json", "r", encoding="utf-8") as config_file:
return json.loads(config_file.read())

WEATHER_API_KEY = os.getenv("WEATHER_API_KEY")
NEWS_API_KEY = os.getenv("NEWS_API_KEY")
CHANNEL_ID = os.getenv("MAIN_CHANNEL_ID")

TIMEZONE = pytz.timezone(configuration_data["timezone"])
MORNING_EMOJI = configuration_data["morning_emoji"]
EARLY_EMOJI = configuration_data["early_emoji"]
BAD_MORNING_EMOJI = configuration_data["bad_morning_emoji"]
SERVER_NAME = configuration_data["server_name"]
MORNING_GIFS = configuration_data["good_morning_gif_urls"]
GOOD_MORNING_PHRASES = configuration_data["good_morning_phrases"]
DEBUG_MODE = configuration_data["debug_mode"]
config = load_config()

SERVER_NAME = config["bot"]["server_name"]
TIMEZONE = pytz.timezone(config["bot"]["timezone"])
DEBUG_MODE = config["bot"]["debug_mode"]

MORNING_EMOJI = config["morning"]["morning_emoji"]
EARLY_EMOJI = config["morning"]["early_emoji"]
BAD_MORNING_EMOJI = config["morning"]["bad_morning_emoji"]
MORNING_GIFS = config["morning"]["good_morning_gif_urls"]
GOOD_MORNING_PHRASES = config["morning"]["good_morning_phrases"]
DEBUG_TIME = 9 # debug line >1
DEBUG_MINUTE = "01:00" # debug line >2

Expand Down
142 changes: 73 additions & 69 deletions config/configuration_data.json
Original file line number Diff line number Diff line change
@@ -1,73 +1,77 @@
{
"server_name": "CS++",
"timezone": "Europe/Dublin",
"morning_emoji": "☀️",
"early_emoji": "🌅",
"bad_morning_emoji": "🤬",
"debug_mode": false,
"good_morning_phrases": [
"good morning",
"maidin mhaith",
"gm",
"buenos días",
"bonjour",
"guten morgen",
"buongiorno",
"bom dia",
"доброе утро",
"早上好",
"おはようございます",
"좋은 아침입니다",
"صباح الخير",
"सुप्रभात",
"habari za asubuhi",
"καλημέρα",
"günaydın",
"god morgon",
"dzień dobry",
"בוקר טוב",
"สวัสดีตอนเช้า",
"hyvää huomenta",
"god morgen",
"buna dimineata",
"bore da",
"beyanî baş",
"bonum mane",
"dobro jutro",
"dobré ráno",
"dobrý deň",
"labas rytas",
"labrīt",
"magandang umaga",
"ata mārie",
"chào buổi sáng",
"өглөөний мэнд",
"suno pona",
"bonan matenon",
"bon matino"
],
"good_morning_gif_urls": [
"https://media.giphy.com/media/hHifLbLhEloqfDwWs0/giphy.gif",
"https://media.giphy.com/media/v1.Y2lkPTc5MGI3NjExYXVwbnE0aGxyN2lkcTZ6ZzZ4d2NlYm5ldmJnYmgyZG9lMjQ5OTI3NiZlcD12MV9pbnRlcm5hbF9naWZfYnlfaWQmY3Q9cw/hVTtBEjpy6hj0OQSFb/giphy.gif",
"https://media.giphy.com/media/v1.Y2lkPTc5MGI3NjExa25ycGx1ZHlmejVudmJ3aG50aTZwenMycHdld2IzbjlzM2tkYW5yNSZlcD12MV9pbnRlcm5hbF9naWZfYnlfaWQmY3Q9Zw/aohA4u5GPmSDjrxYYK/giphy.gif",
"https://media.giphy.com/media/l1KVc1iCZzvpflG80/giphy.gif",
"https://media.giphy.com/media/3iBnSbhSfSuebzcZvT/giphy.gif",
"https://media.giphy.com/media/hUEtOkI8ntRtBLyMfb/giphy.gif",
"https://media.giphy.com/media/TKXMVRt5uvV8OYErao/giphy.gif",
"https://media.giphy.com/media/mxjzBpyu8DDLIcEKVC/giphy.gif",
"https://tenor.com/bfimL.gif",
"https://media.giphy.com/media/hHifLbLhEloqfDwWs0/giphy.gif",
"https://tenor.com/bBf1q.gif",
"https://tenor.com/fM3xHGl6Ng9.gif",
"https://media.giphy.com/media/v1.Y2lkPTc5MGI3NjExZ2o4amxqNnhsd3E4amIzN2VhZmhoOWdmdGV0a2VubG44MjE4ZjVvayZlcD12MV9pbnRlcm5hbF9naWZfYnlfaWQmY3Q9Zw/JSw3ivlumEKZWrxdwp/giphy.gif",
"https://media.giphy.com/media/E3qMYDlq0YIb0qXFug/giphy.gif",
"https://tenor.com/bvvbP.gif",
"https://media.giphy.com/media/lckQGTmmQYdjnXerK2/giphy.gif",
"https://tenor.com/bTyR5.gif",
"https://media0.giphy.com/media/f66sq76KfkDCKoxYSV/giphy.gif",
"https://i.pinimg.com/originals/16/27/71/162771b373fc94042ec3e0e3615c0db1.gif",
"https://tenor.com/bUppN.gif"
],
"bot": {
"server_name": "CS++",
"timezone": "Europe/Dublin",
"debug_mode": false
},
"morning": {
"morning_emoji": "☀️",
"early_emoji": "🌅",
"bad_morning_emoji": "🤬",
"good_morning_phrases": [
"good morning",
"maidin mhaith",
"gm",
"buenos días",
"bonjour",
"guten morgen",
"buongiorno",
"bom dia",
"доброе утро",
"早上好",
"おはようございます",
"좋은 아침입니다",
"صباح الخير",
"सुप्रभात",
"habari za asubuhi",
"καλημέρα",
"günaydın",
"god morgon",
"dzień dobry",
"בוקר טוב",
"สวัสดีตอนเช้า",
"hyvää huomenta",
"god morgen",
"buna dimineata",
"bore da",
"beyanî baş",
"bonum mane",
"dobro jutro",
"dobré ráno",
"dobrý deň",
"labas rytas",
"labrīt",
"magandang umaga",
"ata mārie",
"chào buổi sáng",
"өглөөний мэнд",
"suno pona",
"bonan matenon",
"bon matino"
],
"good_morning_gif_urls": [
"https://media.giphy.com/media/hHifLbLhEloqfDwWs0/giphy.gif",
"https://media.giphy.com/media/v1.Y2lkPTc5MGI3NjExYXVwbnE0aGxyN2lkcTZ6ZzZ4d2NlYm5ldmJnYmgyZG9lMjQ5OTI3NiZlcD12MV9pbnRlcm5hbF9naWZfYnlfaWQmY3Q9cw/hVTtBEjpy6hj0OQSFb/giphy.gif",
"https://media.giphy.com/media/v1.Y2lkPTc5MGI3NjExa25ycGx1ZHlmejVudmJ3aG50aTZwenMycHdld2IzbjlzM2tkYW5yNSZlcD12MV9pbnRlcm5hbF9naWZfYnlfaWQmY3Q9Zw/aohA4u5GPmSDjrxYYK/giphy.gif",
"https://media.giphy.com/media/l1KVc1iCZzvpflG80/giphy.gif",
"https://media.giphy.com/media/3iBnSbhSfSuebzcZvT/giphy.gif",
"https://media.giphy.com/media/hUEtOkI8ntRtBLyMfb/giphy.gif",
"https://media.giphy.com/media/TKXMVRt5uvV8OYErao/giphy.gif",
"https://media.giphy.com/media/mxjzBpyu8DDLIcEKVC/giphy.gif",
"https://tenor.com/bfimL.gif",
"https://media.giphy.com/media/hHifLbLhEloqfDwWs0/giphy.gif",
"https://tenor.com/bBf1q.gif",
"https://tenor.com/fM3xHGl6Ng9.gif",
"https://media.giphy.com/media/v1.Y2lkPTc5MGI3NjExZ2o4amxqNnhsd3E4amIzN2VhZmhoOWdmdGV0a2VubG44MjE4ZjVvayZlcD12MV9pbnRlcm5hbF9naWZfYnlfaWQmY3Q9Zw/JSw3ivlumEKZWrxdwp/giphy.gif",
"https://media.giphy.com/media/E3qMYDlq0YIb0qXFug/giphy.gif",
"https://tenor.com/bvvbP.gif",
"https://media.giphy.com/media/lckQGTmmQYdjnXerK2/giphy.gif",
"https://tenor.com/bTyR5.gif",
"https://media0.giphy.com/media/f66sq76KfkDCKoxYSV/giphy.gif",
"https://i.pinimg.com/originals/16/27/71/162771b373fc94042ec3e0e3615c0db1.gif",
"https://tenor.com/bUppN.gif"
]
},
"easter_egg_patterns": {
"cheesed to meet you": "🧀",
"good corning": "🌽",
Expand Down

0 comments on commit eabc02b

Please sign in to comment.