瀏覽代碼

commonize generateWebClient

Yuki Takei 4 年之前
父節點
當前提交
5d9da9b188
共有 1 個文件被更改,包括 7 次插入2 次删除
  1. 7 2
      packages/slack/src/utils/webclient-factory.ts

+ 7 - 2
packages/slack/src/utils/webclient-factory.ts

@@ -2,6 +2,11 @@ import { LogLevel, WebClient } from '@slack/web-api';
 
 
 const isProduction = process.env.NODE_ENV === 'production';
 const isProduction = process.env.NODE_ENV === 'production';
 
 
-export const generateWebClient = (botToken: string): WebClient => {
-  return new WebClient(botToken, { logLevel: isProduction ? LogLevel.DEBUG : LogLevel.INFO });
+/**
+ * Generate WebClilent instance
+ * @param token Slack Bot Token or Proxy Server URI
+ * @returns
+ */
+export const generateWebClient = (token: string, serverUri?: string): WebClient => {
+  return new WebClient(token, { slackApiUrl: serverUri, logLevel: isProduction ? LogLevel.DEBUG : LogLevel.INFO });
 };
 };