providing password reset services for a long while: circa 2025

feat: add a screen for already created accounts

Changed files
+43
features
+43
features/command.ts
···
const command = async () => {
slackApp.command("/hackatime", async ({ context }) => {
+
const hackatimeUser: { apiKey: string } | null = await fetch(
+
`https://waka.hackclub.com/api/special/apikey?user=${context.userId}`,
+
{
+
headers: {
+
Authorization: `Bearer ${process.env.HACKATIME_API_KEY}`,
+
},
+
},
+
).then((res) => (res.status === 404 ? null : res.json()));
+
+
if (hackatimeUser) {
+
if (context?.respond)
+
await context.respond({
+
response_type: "ephemeral",
+
text: "Hi there! I'm the Hackatime bot :hyper-dino-wave:",
+
blocks: [
+
{
+
type: "section",
+
text: {
+
type: "mrkdwn",
+
text: "Hi there! I'm the Hackatime bot :hyper-dino-wave:",
+
},
+
},
+
{
+
type: "section",
+
text: {
+
type: "mrkdwn",
+
text: `It looks like you already have an account! You can log in to the <https://waka.hackclub.com/login|Hackatime dashboard> with your username \`${context.userId}\` and password :3c:`,
+
},
+
},
+
{
+
type: "context",
+
elements: [
+
{
+
type: "mrkdwn",
+
text: `your api key for the Hackatime API is \`${hackatimeUser.apiKey}\``,
+
},
+
],
+
},
+
],
+
});
+
return;
+
}
+
context.respond({
response_type: "ephemeral",
text: "Hi there! I'm the Hackatime bot :hyper-dino-wave:",