a fun bot for the hc slack
at main 120 lines 3.5 kB view raw view rendered
1# The Takes Project 2 3<img src="https://raw.githubusercontent.com/taciturnaxolotl/takes/main/.github/images/smokie.svg" height="175" align="right" alt="smokie the bear"> 4 5> ### More deets coming soon 👀 🏔️ 📹 6> A slack bot that tracks takes and accepts uploads; developed with 💖 @ [Hack Club](https://github.com/hackclub) 7> 8> ⚠️ **Highly opinionated slack bot warning** - Project rapidly iterating 9 10## 🚧 Dev 11 12You can launch the bot locally with bun 13 14```bash 15bun install 16bun dev 17``` 18 19you will also need to launch an ngrok tunnel and update your dev slack manifest to point to the ngrok tunnel 20 21```bash 22bun ngrok 23``` 24 25you also need to create a `.env` file with the following keys 26 27```bash 28SLACK_BOT_TOKEN="xoxb-xxxxx-xxxxx-xxxxx-xxxxx" 29SLACK_SIGNING_SECRET="xxxxx" 30SLACK_SPAM_CHANNEL="C069N64PW4A" 31SLACK_LOG_CHANNEL="C08KX2YNN87" 32SLACK_REVIEW_CHANNEL="C07P0CXT08H" 33SLACK_LISTEN_CHANNEL="C08NEE6FVJT" 34NODE_ENV="dev" 35SLACK_USER_TOKEN="xoxp-xxxxx-xxxxx-xxxxx-xxxxx" 36API_URL="https://casual-renewing-reptile.ngrok-free.app" 37SENTRY_DSN="https://xxxxxx@xxxxxx.ingest.us.sentry.io/xxxx" 38DATABASE_URL="postgres://username:password@host:5432/smokie" 39CDN_TOKEN="cdn_token" 40``` 41 42## 🔌 API Docs 43 44all endpoints are prefixed with `/api` and return JSON unless specified otherwise 45 46``` 47GET /api/video?media=<url> 48``` 49returns an HTML page with a video player for the given media URL 50 51``` 52GET /api/recentTakes?user=<userId> 53``` 54returns recent takes, optionally filtered by user ID 55- if user not found, returns `404` with an empty takes array 56- returns up to 40 takes ordered by creation date (newest first) 57- includes project info and total time stats 58- includes userName for each take 59 60``` 61GET /api/projects?user=<userId> 62``` 63returns project info 64- with user param: returns a single project for that user 65- without user param: returns all projects 66- returns empty array if no projects found 67- includes userName for each project 68 69``` 70GET /api/time?user=<userId> 71``` 72returns the total time spent on takes for a user and daily time statistics 73- requires userId parameter 74- returns 400 if userId is missing 75- returns 404 if user not found 76- includes totalTakesTime (in seconds) and dailyStats showing time logged per day 77 78typical take object looks like: 79```ts 80{ 81 id: string; 82 userId: string; 83 notes: string; 84 createdAt: Date; 85 mediaUrls: string[]; 86 elapsedTime: number; // seconds 87 project: string; 88 totalTakesTime: number; // seconds 89 userName: string; 90} 91``` 92 93typical project object looks like: 94```ts 95{ 96 projectName: string; 97 projectDescription: string; 98 projectBannerUrl: string; 99 totalTakesTime: number; // seconds 100 userId: string; 101 userName: string; 102 takesCount: number; 103} 104``` 105 106## 📜 License 107 108The code is licensed under `MIT`! That means MIT allows for free use, modification, and distribution of the software, requiring only that the original copyright notice and disclaimer are included in copies. All artwork and images are copyright reserved but may be used with proper attribution to the authors. 109 110<p align="center"> 111 <img src="https://raw.githubusercontent.com/taciturnaxolotl/carriage/master/.github/images/line-break.svg" /> 112</p> 113 114<p align="center"> 115 <i><code>&copy 2025-present <a href="https://github.com/taciturnaxolotl">Kieran Klukas</a></code></i> 116</p> 117 118<p align="center"> 119 <a href="https://github.com/taciturnaxolotl/takes/blob/master/LICENSE.md"><img src="https://img.shields.io/static/v1.svg?style=for-the-badge&label=License&message=MIT&logoColor=d9e0ee&colorA=363a4f&colorB=b7bdf8"/></a> 120</p>