update: finish up

This commit is contained in:
NeonGamerBot-QK 2024-11-16 22:25:33 -05:00
parent d1b2e59227
commit 18e6f3f933
No known key found for this signature in database
GPG key ID: 8A8B64515254CFC6

View file

@ -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))} - [<https://github.com/NeonGamerBot-QK/${d.repo}|repo>], [<${d.mlink}|message link>] `).join("\n> ")}`,
});
}
}