浏览代码

fix slash-command-parse.ts

zahmis 5 年之前
父节点
当前提交
89117495ac
共有 1 个文件被更改,包括 7 次插入6 次删除
  1. 7 6
      packages/slack/src/utils/slash-command-parser.ts

+ 7 - 6
packages/slack/src/utils/slash-command-parser.ts

@@ -1,17 +1,18 @@
 import { SlashCommand } from '@slack/bolt';
 
-import { GrowiCommand } from '~/interfaces/growi-command';
-import { InvalidGrowiCommandError } from '~/models/errors';
+import { GrowiCommand } from '../interfaces/growi-command';
+import { InvalidGrowiCommandError } from '../models/errors';
 
 export const parse = (slashCommand: SlashCommand): GrowiCommand => {
-  const splitted = slashCommand.text.split(' ');
-  if (splitted.length < 2) {
+  console.log(slashCommand);
+  const splitted = slashCommand.command.split(' ');
+  if (splitted.length < 1) {
     throw new InvalidGrowiCommandError('The SlashCommand.text does not specify GrowiCommand type');
   }
 
   return {
     text: slashCommand.text,
-    growiCommandType: splitted[0],
-    growiCommandArgs: splitted.slice(1),
+    growiCommandType: 'hoge',
+    growiCommandArgs: ['fugo'],
   };
 };