mirror of
https://github.com/System-End/slack-end.git
synced 2026-04-19 19:45:11 +00:00
update: finish up
This commit is contained in:
parent
d1b2e59227
commit
18e6f3f933
1 changed files with 14 additions and 3 deletions
|
|
@ -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> ")}`,
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue