revert(slack): use packaged thread status method

This commit is contained in:
@zimeg
2026-04-04 13:15:57 -07:00
parent 68b84980cc
commit 28e1142a24

View File

@@ -260,13 +260,28 @@ 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 {
await params.app.client.assistant.threads.setStatus({
token: params.botToken,
channel_id: p.channelId,
thread_ts: p.threadTs,
status: p.status,
});
if (client.assistant?.threads?.setStatus) {
await client.assistant.threads.setStatus(payload);
return;
}
if (typeof client.apiCall === "function") {
await client.apiCall("assistant.threads.setStatus", payload);
}
} catch (err) {
logVerbose(`slack status update failed for channel ${p.channelId}: ${String(err)}`);
}