mirror of
https://github.com/moltbot/moltbot.git
synced 2026-04-21 13:44:03 +00:00
revert(slack): use packaged thread status method
This commit is contained in:
@@ -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)}`);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user