refactor(slack): use packaged thread status method

This commit is contained in:
@zimeg
2026-04-14 12:55:06 -07:00
parent fdbb0fb561
commit d35bdf6311

View File

@@ -274,28 +274,13 @@ export function createSlackMonitorContext(params: {
if (!p.threadTs) {
return;
}
const payload = {
token: params.botToken,
channel_id: p.channelId,
thread_ts: p.threadTs,
status: p.status,
};
const client = params.app.client as unknown as {
assistant?: {
threads?: {
setStatus?: (args: typeof payload) => Promise<unknown>;
};
};
apiCall?: (method: string, args: typeof payload) => Promise<unknown>;
};
try {
if (client.assistant?.threads?.setStatus) {
await client.assistant.threads.setStatus(payload);
return;
}
if (typeof client.apiCall === "function") {
await client.apiCall("assistant.threads.setStatus", payload);
}
await params.app.client.assistant.threads.setStatus({
token: params.botToken,
channel_id: p.channelId,
thread_ts: p.threadTs,
status: p.status,
});
} catch (err) {
logVerbose(`slack status update failed for channel ${p.channelId}: ${String(err)}`);
}