Skip to content

Commit

Permalink
add db field for checking if person wants birthdaybot to post
Browse files Browse the repository at this point in the history
  • Loading branch information
AndreasTauge committed Apr 27, 2024
1 parent 99beb4e commit 070abf4
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions main.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ def main():
client = WebClient(os.environ.get("SLACK_APP_TOKEN"))
response = client.users_list()
# Execute SELECT query to fetch all rows from the Member table
cursor.execute("SELECT activeStatus, name, birthday, slackID FROM Member")
cursor.execute("SELECT activeStatus, name, birthday, slackID, birthdayBot FROM Member")

# Fetch all rows
rows = cursor.fetchall()
Expand All @@ -37,7 +37,7 @@ def main():

#go through rows and see if birthday matches date
for row in rows:
if row[0] == 1 and row[2]:
if row[0] == 1 and row[4] == 1 and row[2]:
name_list = row[1].lower().split(" ")
if row[2].strftime("%m-%d") == datetime.today().strftime("%m-%d"):
slack_send_message(name_list, response, row[3])
Expand Down

0 comments on commit 070abf4

Please sign in to comment.