Skip to content

Commit

Permalink
updated python job to include tests
Browse files Browse the repository at this point in the history
  • Loading branch information
coillteoir committed May 8, 2024
1 parent 19c3c3d commit 2c97862
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 11 deletions.
3 changes: 1 addition & 2 deletions .github/workflows/python-lint.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
2 changes: 0 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -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
Expand Down
11 changes: 4 additions & 7 deletions bot/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
client = discord.Client(intents=intents)


class Bot():
class Bot:
def __init__(self, path):
config = None

Expand All @@ -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")
Expand All @@ -59,6 +58,7 @@ def __init__(self, path):

self.leaderboard = Leaderboard(self.channel_id)


bot = Bot("config/configuration_data.json")


Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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,
Expand All @@ -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

Expand Down

0 comments on commit 2c97862

Please sign in to comment.