diff --git a/.github/workflows/python-lint.yaml b/.github/workflows/python-lint.yaml index 37e646e..264195c 100644 --- a/.github/workflows/python-lint.yaml +++ b/.github/workflows/python-lint.yaml @@ -12,7 +12,6 @@ jobs: - run: echo "Packages installed" - uses: actions/checkout@v3 - run: pip install -r requirements.txt - - run: echo "Checked out into ${{ github.repository }} on branch ${{ github.ref }}" - - run: ls - run: black . --diff - run: pylint **/*.py --rcfile=.pylintrc + - run: python test.py diff --git a/Dockerfile b/Dockerfile index 4d92050..e900df4 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,10 +1,8 @@ from python:3.11-slim -run mkdir -p /workspace/morningbot workdir /workspace/morningbot copy requirements.txt requirements.txt - run pip install -r requirements.txt copy bot bot diff --git a/bot/__init__.py b/bot/__init__.py index cb343f1..b63626c 100644 --- a/bot/__init__.py +++ b/bot/__init__.py @@ -21,7 +21,7 @@ client = discord.Client(intents=intents) -class Bot(): +class Bot: def __init__(self, path): config = None @@ -32,7 +32,6 @@ def __init__(self, path): print("config could not be loaded", sys.stderr) return - self.weather_api_key = os.getenv("WEATHER_API_KEY") self.news_api_key = os.getenv("NEWS_API_KEY") self.channel_id = os.getenv("MAIN_CHANNEL_ID") @@ -59,6 +58,7 @@ def __init__(self, path): self.leaderboard = Leaderboard(self.channel_id) + bot = Bot("config/configuration_data.json") @@ -111,6 +111,7 @@ async def on_ready(): send_message.start() print(f"We have logged in as {client.user}, time is {get_current_hour()}") + @client.event async def on_message(message): if message.author == client.user: @@ -190,15 +191,12 @@ async def afternoon_message(): # If theres no early bird, dont send the message if bot.first_gm is False: return - temp_first = bot.first_gm_user - bot.first_gm = False - bot.first_gm_user = None channel = client.get_channel(bot.channel_id) embed = discord.Embed( title=f"Good Afternoon, {bot.server_name}!", description=( - "Todays early bird was {temp_first}!\n\n \ + "Todays early bird was {bot.first_gm_user}!\n\n \ Leaderboard:{bot.leaderboard}" ), color=0x00FF00, @@ -207,7 +205,6 @@ async def afternoon_message(): await channel.send(embed=embed) # Reset early bird every day - bot.first_gm = False bot.first_gm_user = None