Skip to content

tongliu999/shift-checker

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

49 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Shift Checker

A Slack bot for managing hackathon organizer schedules and shifts.

Features

  • Organizer Management: Add and edit organizer information
  • Shift Management: Add, edit, and delete individual shifts
  • Schedule Management: Bulk import schedules from CSV data
  • Schedule Viewing: View schedules for specific dates
  • Schedule Clearing: Clear all shifts for a specific date

Commands

Organizer Commands

  • /add_organizer - Add yourself as an organizer
  • /edit_organizer - Update your organizer information

Shift Commands

  • /add_shift <name> <start_time> <shift_type> <location> - Add a single shift
  • /edit_shift <name> <start_time> <shift_type> [new_name] [new_start_time] [new_shift_type] [new_location] - Edit an existing shift

Schedule Commands

  • /add_schedule <filename> - Import a complete schedule from a CSV file in the schedule folder
  • /clear_schedule <date> - Clear all shifts for a specific date

Schedule Folder Structure

Place your CSV schedule files in the schedule/ folder. The bot automatically maps filenames to dates:

  • friday.csv → 2024-09-13
  • saturday.csv → 2024-09-14
  • sunday.csv → 2024-09-15

Note: You can customize these date mappings in the extract_date_from_filename() function in app/slack.py to match your actual hackathon dates.

Supported Time Formats

  • 12:00 AM - 12-hour format with AM/PM
  • 00:00 - 24-hour format (automatically converted)

Date Formats for Commands

  • MM/DD/YYYY - e.g., 09/14/2024
  • YYYY-MM-DD - e.g., 2024-09-14
  • Month DD, YYYY - e.g., September 14, 2024

Installation

  1. Install dependencies:

    pip install -r requirements.txt
  2. Set up environment variables:

    SLACK_BOT_TOKEN=your_slack_bot_token
    SLACK_SIGNING_SECRET=your_slack_signing_secret
    SUPABASE_URL=your_supabase_url
    SUPABASE_KEY=your_supabase_key
    SLACK_CHANNEL=your_slack_channel
  3. Run the application:

    python app/app.py

Testing

Run the CSV parsing test:

python test_csv_parsing.py

Database Schema

The application uses Supabase with the following tables:

organizers

  • organizer_id (primary key)
  • name

shifts

  • name
  • start_time
  • shift_type
  • location

Usage Examples

Adding a Schedule

  1. Place your CSV file in the schedule/ folder
  2. Use the command: /add_schedule <filename> (e.g., /add_schedule saturday.csv)
  3. The bot will read the file and add all shifts to the database

Clearing a Schedule

  • Clear a specific date: /clear_schedule 09/14/2024

Error Handling

The bot provides helpful error messages for:

  • Invalid CSV format
  • Missing date information
  • Database connection issues
  • Invalid date formats

Contributing

Feel free to submit issues and enhancement requests!

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages