zahmis 5 lat temu
rodzic
commit
2b6495aa09

+ 2 - 5
packages/slack/src/index.ts

@@ -1,11 +1,8 @@
-
-
 export const supportedSlackCommands: string[] = [
 export const supportedSlackCommands: string[] = [
   '/growi',
   '/growi',
 ];
 ];
 
 
 export const supportedGrowiCommandsMappings = {
 export const supportedGrowiCommandsMappings = {
-  search: 'Search',
-  create: 'Create',
-  register: 'Register',
+  search: 'search',
+  create: 'create',
 };
 };

+ 8 - 5
packages/slackbot-proxy/src/controllers/slack.ts

@@ -6,7 +6,7 @@ import { Installation } from '~/entities/installation';
 import { InstallationRepository } from '~/repositories/installation';
 import { InstallationRepository } from '~/repositories/installation';
 
 
 import { InstallerService } from '~/services/InstallerService';
 import { InstallerService } from '~/services/InstallerService';
-import { registerService } from '~/services/RegisterService';
+import { RegisterService } from '~/services/RegisterService';
 
 
 @Controller('/slack')
 @Controller('/slack')
 export class SlackCtrl {
 export class SlackCtrl {
@@ -62,12 +62,15 @@ export class SlackCtrl {
     // See https://api.slack.com/apis/connections/events-api#the-events-api__responding-to-events
     // See https://api.slack.com/apis/connections/events-api#the-events-api__responding-to-events
 
 
     const method = supportedGrowiCommandsMappings[body.text];
     const method = supportedGrowiCommandsMappings[body.text];
-    const methodService = `${method}Service`;
+    // const methodService = `${method}Service`;
     const modulePath = `../services/${method}Service`;
     const modulePath = `../services/${method}Service`;
-    const targetModule = require(modulePath);
+    const { RegisterService } = require(modulePath);
     // const targetModuleAction = Object.values(targetModule);
     // const targetModuleAction = Object.values(targetModule);
-    const service = targetModule.methodService;
-    console.log(service);
+    // const service = targetModule.methodService;
+    await RegisterService(body);
+    console.log(RegisterService);
+    // console.log(service);
+    // console.log(methodService);
 
 
 
 
     // await targeModuleAction(body);
     // await targeModuleAction(body);

+ 1 - 1
packages/slackbot-proxy/src/services/RegisterService.ts

@@ -1,7 +1,7 @@
 import { WebClient, LogLevel } from '@slack/web-api';
 import { WebClient, LogLevel } from '@slack/web-api';
 import { generateInputSectionBlock } from '@growi/slack/src/utils/block-creater';
 import { generateInputSectionBlock } from '@growi/slack/src/utils/block-creater';
 
 
-export async function registerService(body:{[key:string]:string}): Promise<void> {
+export async function RegisterService(body:{[key:string]:string}): Promise<void> {
 
 
   // tmp use process.env
   // tmp use process.env
   const client = new WebClient(process.env.SLACK_BOT_USER_OAUTH_TOKEN, { logLevel: LogLevel.DEBUG });
   const client = new WebClient(process.env.SLACK_BOT_USER_OAUTH_TOKEN, { logLevel: LogLevel.DEBUG });