# After-Hours Shift Manager ![Python](https://img.shields.io/badge/Python-3776AB?logo=python&logoColor=white) ![Terraform](https://img.shields.io/badge/Terraform-844FBA?logo=terraform&logoColor=white) ![Slack](https://img.shields.io/badge/Slack-integration-4A154B?logo=slack&logoColor=white) ![CI](https://github.com/Sea-Haven-Industries/afterhours-shift-manager/actions/workflows/ci.yaml/badge.svg) Slack bot for managing after-hours on-call shifts at Sea Haven Industries. Employees can pick up, drop, and swap shifts directly from Slack. Changes automatically update 3CX queue routing via the integrated ring scheduler. ## How It Works A recurring weekly schedule assigns employees to after-hours phone duty. Weekend shifts are split into Day (8am-5pm) and Night (5pm-8am). Any unassigned shift shows as **Available** in Slack with a pickup button. When someone picks up or drops a shift for today, the 3CX queue is updated immediately. Future changes take effect when the ring scheduler runs at 8am daily and 5pm on weekends. The work week runs Sunday through Saturday, matching payroll. A Saturday night shift (5pm Saturday through 8am Sunday) stays in the Saturday week. Sunday day and Sunday night open the next week. The Monday 7am post shows the week that started the day before, plus the following week, and the pay summary covers the previous Sunday through Saturday. The weekly schedule post is updated live when shifts change, and the previous week's post is automatically deleted when the new one goes out. The bot also has an **About** page: open the bot in Slack and click its **Home** tab to see what it does, the full command list, and the latest "What's New" (see [Releases & Versioning](#releases--versioning)). Employees can do the same pick, drop, swap, and admin work from the internal portal After Hours pages. Slack DMs for swaps and late pickups still go out. App Home admin modals stay as they are. ## Slack Commands | Command | Description | |---|---| | `/oncall` | Show this week's schedule | | `/oncall next` | Show next week's schedule | | `/oncall pick ` | Pick up an available shift — instant if the shift hasn't started; if it's already underway (but not ended) it needs admin approval (see [Late-pickup approval](#late-pickup-approval)) | | `/oncall drop ` | Drop your shift (marks it available) — blocked within 24h of shift start; swap or ask an admin instead | | `/oncall swap @person` | Request a swap — the other person gets an Accept/Decline DM and the shift only moves once they accept | | `/oncall register ` | Link your Slack account to your phone extension | | `/oncall roster` | Show all employees and their link status | | `/oncall pay` | Show last week's bonus pay summary (Sunday through Saturday) | | `/oncall rate` | Show current shift pay rates | | `/oncall rate default ` | Set the default per-shift rate | | `/oncall rate ` | Set a per-person shift rate | | `/oncall help` | Show help | ### Admin Commands Available to users listed in `admin_users` in the CONFIG record: | Command | Description | |---|---| | `/oncall admin override ` | Assign a shift to an extension | | `/oncall admin open ` | Mark a shift as open | | `/oncall admin clear ` | Remove override (revert to weekly) | | `/oncall admin roster add ` | Add an employee to the roster | | `/oncall admin roster remove ` | Remove an employee | | `/oncall admin roster rename ` | Rename an employee | | `/oncall admin holiday add [x]