Skip to content

Commit

Permalink
Use dotenv the way it's meant to be used
Browse files Browse the repository at this point in the history
  • Loading branch information
Zalk0 committed Oct 22, 2023
1 parent 0f2aafb commit 7a63e06
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
7 changes: 4 additions & 3 deletions bot.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import logging
import os

import discord
from dotenv import dotenv_values


import tasks
from commands_list import commands_list
Expand All @@ -13,8 +14,8 @@ class ChouetteBot(discord.Client):

# Initialization when class is called
def __init__(self):
# Associate the config to the bot
self.config = dotenv_values()
# Associate the env variables to the bot
self.config = os.environ

# Define the bot debug log level
self.bot_logger = logging.getLogger('bot')
Expand Down
5 changes: 5 additions & 0 deletions main.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,15 @@
import logging.handlers as handlers
import os

from dotenv import load_dotenv

from bot import ChouetteBot


def main():
# Load the .env values
load_dotenv()

# Create an instance of the ChouetteBot
client = ChouetteBot()

Expand Down

0 comments on commit 7a63e06

Please sign in to comment.