From 18e6f3f93375cba8ce39c4bc4242d084021734c6 Mon Sep 17 00:00:00 2001 From: NeonGamerBot-QK Date: Sat, 16 Nov 2024 22:25:33 -0500 Subject: [PATCH] update: finish up --- src/modules/howWasYourDay.ts | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/src/modules/howWasYourDay.ts b/src/modules/howWasYourDay.ts index 06a6cf4..f760510 100644 --- a/src/modules/howWasYourDay.ts +++ b/src/modules/howWasYourDay.ts @@ -6,6 +6,7 @@ import { ModifiedApp } from "./slackapp"; import { getTodaysEvents } from "./hw"; import { GitBody, GitSession } from "./projectWaterydo"; import ms from "ms"; +import { hacktime } from "."; export async function getDayResponse(db: JSONdb) { const hw = await getTodaysEvents().then((e: any) => { const start = []; @@ -57,13 +58,21 @@ export function listenForResponse(app: ModifiedApp, filter: any) { // TODO: find a way to stop the event after xyz time app.event("message", messageListener); } -export default async function (app: ModifiedApp) { +export default async function (app: ModifiedApp, channel = `C07R8DYAZMM`) { const db = app.db; const getStr = await getDayResponse(db); const mobj = await app.client.chat.postMessage({ - channel: `C07R8DYAZMM`, + channel, text: getStr, }); + const formattedHacktimeResults = await hacktime.getStatusBar().then(d => { + return d.map(e => `- *${e.name}*: \`${e.text}\``).join('\n') + }) + app.client.chat.postMessage({ + channel, + thread_ts: mobj.ts, + text: `Here are your :wakatime-dark: hacktime stats for today:\n${formattedHacktimeResults}` + }) const today = new Date(); const codewatcherForToday = ( (app.db.get("git_session") || []) as GitSession[] @@ -80,11 +89,13 @@ export default async function (app: ModifiedApp) { f.getFullYear() == today.getFullYear() ); }); + if (codewatcherForToday.length > 0) { app.client.chat.postMessage({ - channel: `C07R8DYAZMM`, + channel, thread_ts: mobj.ts, text: `Well well well it also looks like you were using codewatcher today\n${codewatcherForToday.some((d) => d.repo.includes("zeon")) ? "> and i see u worked on some of my code :D you better have not fucked me up\n" : ""}Anyways here are the projects you recorded:\n> ${codewatcherForToday.map((d) => `Project: ${d.repo} which was recorded in <#${d.channel}> and lasted for an for ${ms(Math.round((d.ended_at || Date.now()) - d.started_at))} - [], [<${d.mlink}|message link>] `).join("\n> ")}`, }); } + }