mirror of
https://github.com/openclaw/openclaw.git
synced 2026-03-13 11:00:50 +00:00
21 lines
594 B
TypeScript
21 lines
594 B
TypeScript
import { type RetryOptions, type WebClientOptions, WebClient } from "@slack/web-api";
|
|
|
|
export const SLACK_DEFAULT_RETRY_OPTIONS: RetryOptions = {
|
|
retries: 2,
|
|
factor: 2,
|
|
minTimeout: 500,
|
|
maxTimeout: 3000,
|
|
randomize: true,
|
|
};
|
|
|
|
export function resolveSlackWebClientOptions(options: WebClientOptions = {}): WebClientOptions {
|
|
return {
|
|
...options,
|
|
retryConfig: options.retryConfig ?? SLACK_DEFAULT_RETRY_OPTIONS,
|
|
};
|
|
}
|
|
|
|
export function createSlackWebClient(token: string, options: WebClientOptions = {}) {
|
|
return new WebClient(token, resolveSlackWebClientOptions(options));
|
|
}
|