···
import { takes as takesTable } from "../../../libs/schema";
import { eq, and } from "drizzle-orm";
import { prettyPrintTime } from "../../../libs/time";
-
import { calculateElapsedTime } from "../../../libs/time-periods";
export default async function upload() {
slackApp.anyMessage(async ({ payload }) => {
···
console.error("Error handling file message:", error);
slackApp.action("select_multiplier", async () => {});
slackApp.action("approve", async ({ payload, context }) => {
-
const multiplier = Object.values(payload.state.values)[0]
-
?.select_multiplier?.selected_option?.value;
-
const takeId = payload.actions[0]?.value;
-
.where(eq(takesTable.id, takeId));
-
if (take.length === 0) {
-
const takeToApprove = take[0];
-
if (!takeToApprove) return;
-
multiplier: multiplier,
-
.where(eq(takesTable.id, takeId));
-
await slackClient.chat.postMessage({
-
channel: payload.user.id,
-
thread_ts: take[0]?.ts as string,
-
text: `take approved with multiplier \`${multiplier}\` so you have earned *${Number((takeToApprove.elapsedTimeMs * Number(multiplier)) / 60).toFixed(1)} takes*!`,
-
// delete the message from the review channel
-
await context.respond({
slackApp.action("reject", async ({ payload, context }) => {
-
const takeId = payload.actions[0]?.value;
-
.where(eq(takesTable.id, takeId));
-
if (take.length === 0) {
-
.where(eq(takesTable.id, takeId));
-
await slackClient.chat.postMessage({
-
channel: payload.user.id,
-
thread_ts: take[0]?.ts as string,
-
text: "take rejected :(",
-
// delete the message from the review channel
-
await context.respond({
···
import { takes as takesTable } from "../../../libs/schema";
import { eq, and } from "drizzle-orm";
import { prettyPrintTime } from "../../../libs/time";
+
import * as Sentry from "@sentry/bun";
export default async function upload() {
slackApp.anyMessage(async ({ payload }) => {
···
console.error("Error handling file message:", error);
+
await slackClient.chat.postMessage({
+
channel: payload.channel,
+
thread_ts: payload.thread_ts,
+
text: ":warning: there was an error processing your upload",
+
Sentry.captureException(error, {
+
channel: payload.channel,
+
thread_ts: payload.thread_ts,
+
type: "file_upload_error",
slackApp.action("select_multiplier", async () => {});
slackApp.action("approve", async ({ payload, context }) => {
+
const multiplier = Object.values(payload.state.values)[0]
+
?.select_multiplier?.selected_option?.value;
+
const takeId = payload.actions[0]?.value;
+
.where(eq(takesTable.id, takeId));
+
if (take.length === 0) {
+
const takeToApprove = take[0];
+
if (!takeToApprove) return;
+
multiplier: multiplier,
+
.where(eq(takesTable.id, takeId));
+
await slackClient.chat.postMessage({
+
channel: payload.user.id,
+
thread_ts: take[0]?.ts as string,
+
text: `take approved with multiplier \`${multiplier}\` so you have earned *${Number((takeToApprove.elapsedTimeMs * Number(multiplier)) / 60).toFixed(1)} takes*!`,
+
// delete the message from the review channel
+
await context.respond({
+
console.error("Error approving take:", error);
+
await slackClient.chat.postEphemeral({
+
channel: process.env.SLACK_REVIEW_CHANNEL || "",
+
text: ":warning: there was an error approving the take",
+
Sentry.captureException(error, {
+
take: payload.actions[0]?.value,
+
userApproving: payload.user,
+
type: "take_approve_error",
slackApp.action("reject", async ({ payload, context }) => {
+
const takeId = payload.actions[0]?.value;
+
.where(eq(takesTable.id, takeId));
+
if (take.length === 0) {
+
.where(eq(takesTable.id, takeId));
+
await slackClient.chat.postMessage({
+
channel: payload.user.id,
+
thread_ts: take[0]?.ts as string,
+
text: "take rejected :(",
+
// delete the message from the review channel
+
await context.respond({
+
console.error("Error rejecting take:", error);
+
await slackClient.chat.postEphemeral({
+
channel: process.env.SLACK_REVIEW_CHANNEL || "",
+
text: ":warning: there was an error rejecting the take",
+
Sentry.captureException(error, {
+
take: payload.actions[0]?.value,
+
userRejecting: payload.user,
+
type: "take_reject_error",