providing password reset services for a long while: circa 2025
1<h1 align="center"> 2 <img src="https://raw.githubusercontent.com/taciturnaxolotl/hackatime-bot/master/.github/images/logo-round.svg" width="200" alt="Logo"/><br/> 3 <img src="https://raw.githubusercontent.com/taciturnaxolotl/carriage/master/.github/images/transparent.png" height="45" width="0px"/> 4 Hackatime Slack Bot 5 <img src="https://raw.githubusercontent.com/taciturnaxolotl/carriage/master/.github/images/transparent.png" height="30" width="0px"/> 6</h1> 7 8<p align="center"> 9 <i>signup for a hackatime account and get password resets; all on on the hackclub slack!</i> 10</p> 11 12<p align="center"> 13 <img src="https://raw.githubusercontent.com/taciturnaxolotl/carriage/master/.github/images/line-break-thin.svg" /> 14</p> 15 16<p align="center"> 17 <img src="https://raw.githubusercontent.com/taciturnaxolotl/hackatime-bot/master/.github/images/out.gif" /> 18</p> 19 20<p align="center"> 21 <img src="https://raw.githubusercontent.com/taciturnaxolotl/carriage/master/.github/images/line-break-thin.svg" /> 22</p> 23 24## How do I use it? 25 26Run the `/hackatime` command in the slack and it will prompt you to click a button to create an account if you don't have one, or to reset your password if you do. 27 28<p align="center"> 29 <img src="/.github/images/create-account-1.webp" width="500" alt="creating an account"/> 30 <img src="/.github/images/has_account.webp" width="500" alt="creating an account - success"/> 31</p> 32 33### From a developer's perspective 34 35There is a sweet message queue that is used to handle all hackatime slack messages. This is handled and persisted across restarts with `bun:sqlite`. To access the queue you need an admin token which you can ask me for on slack ([@krn](https://hackclub.slack.com/team/U062UG485EE)). 36 37The queue is interacted with via a `POST` request to `/slack/message` with a `channel`, `text`, and (optionally) `blocks` json encoded in the body. 38 39```bash 40curl -X POST "https://hackatime-bot.kierank.hackclub.app/slack/message" \ 41-H "Content-Type: application/json" \ 42-H "Authorization: Bearer NOTLEEKINGTHATLOL" \ 43-d '{ 44 "channel": "U062UG485EE", 45 "text": "Hello from hackatime!" 46}' 47``` 48 49or via fetch with blocks 50 51```typescript 52await fetch("https://hackatime-bot.kierank.hackclub.app/slack/message", { 53 method: "POST", 54 headers: { 55 "Content-Type": "application/json", 56 Authorization: `Bearer ${process.env.MESSAGE_QUEUE_TOKEN}`, 57 }, 58 body: JSON.stringify({ 59 channel: "U062UG485EE", 60 text: "Hello from hackatime!", 61 blocks: [ 62 { 63 type: "section", 64 text: { 65 type: "mrkdwn", 66 text: "Hello from hackatime!", 67 }, 68 }, 69 { 70 type: "divider", 71 }, 72 { 73 type: "context", 74 elements: [ 75 { 76 type: "mrkdwn", 77 text: "This is a message from the hackatime slack bot!", 78 }, 79 ], 80 }, 81 ], 82 }), 83}); 84``` 85 86## Devving 87 88Create a slack app as per the [manifest.yaml](manifest.yaml) and an env as below 89 90```bash 91SLACK_BOT_TOKEN=xoxb-xxx-xxxx-xxxxxx 92SLACK_SIGNING_SECRET=xxxxxx 93NODE_ENV=development 94ADMINS=U062UG485EE 95HACKATIME_API_KEY=xxxxxx 96``` 97 98```bash 99bun install 100bun run index.ts 101``` 102 103then start an ngrok 104 105```bash 106ngrok http --domain casual-renewing-reptile.ngrok-free.app 3000 107``` 108 109## Screenshots 110 111<details> 112<summary>A bunch of screenshots of all the models</summary> 113 114#### Initial Signup 115 116Run the `/hackatime` command in slack and it will start the signup process 117 118![creating an account](/.github/images/create-account-1.webp) 119*First you'll see the initial signup prompt* 120 121![cancel creating account](/.github/images/no-worries.webp) 122*No pressure - you can always cancel if you change your mind* 123 124![creating an account - password](/.github/images/create-account-2.webp) 125*Choose a secure password that meets the requirements* 126 127![creating an account - bad password](/.github/images/create-account-null.webp) 128*Make sure to enter a valid password!* 129 130![creating an account - confirm](/.github/images/create-account-3.webp) 131*Confirm your password to make sure it's entered correctly* 132 133![creating an account - success](/.github/images/create-account-4.webp) 134*Success! Your account is now created* 135 136#### Existing Account 137 138After you've created an account, you can reset your password if needed by again running the `/hackatime` command in slack 139 140![has account](/.github/images/has_account.webp) 141*The bot will recognize your existing account* 142 143![resetting a password](/.github/images/reset-password.webp) 144*You can easily reset your password if needed* 145 146</details> 147 148<p align="center"> 149 <img src="https://raw.githubusercontent.com/taciturnaxolotl/carriage/master/.github/images/line-break.svg" /> 150</p> 151 152<p align="center"> 153 <i><code>&copy 2025-present <a href="https://github.com/taciturnaxolotl">Kieran Klukas</a></code></i> 154</p> 155 156<p align="center"> 157 <a href="https://github.com/taciturnaxolotl/carriage/blob/master/LICENSE.md"><img src="https://img.shields.io/static/v1.svg?style=for-the-badge&label=License&message=AGPL 3.0&logoColor=d9e0ee&colorA=363a4f&colorB=b7bdf8"/></a> 158</p>