|
|
@@ -1,21 +1,43 @@
|
|
|
+import { WebClient, LogLevel } from '@slack/web-api';
|
|
|
import { parse } from '../utils/slash-command-parser';
|
|
|
|
|
|
-export class RegisterService {
|
|
|
|
|
|
- receiveBody(parseBody) {
|
|
|
- const body = parse(parseBody);
|
|
|
- const commandType = body.growiCommandArgs;
|
|
|
- const commandArgs = body.growiCommandType;
|
|
|
+export const openModal = async(body) => {
|
|
|
|
|
|
- if (commandType === 'register') {
|
|
|
- this.openModal();
|
|
|
- return;
|
|
|
- }
|
|
|
- }
|
|
|
+ const client = new WebClient('xoxb-1399660543842-1848670292404-huKeykaKhdyLyBqTiVlMxqY8', { logLevel: LogLevel.DEBUG });
|
|
|
|
|
|
- openModal() {
|
|
|
- console.log('open');
|
|
|
- }
|
|
|
+ await client.views.open({
|
|
|
+ trigger_id: body.trigger_id,
|
|
|
+ view: {
|
|
|
+ type: 'modal',
|
|
|
+ title: {
|
|
|
+ type: 'plain_text',
|
|
|
+ text: 'My App',
|
|
|
+ },
|
|
|
+ close: {
|
|
|
+ type: 'plain_text',
|
|
|
+ text: 'Close',
|
|
|
+ },
|
|
|
+ blocks: [
|
|
|
+ {
|
|
|
+ type: 'section',
|
|
|
+ text: {
|
|
|
+ type: 'mrkdwn',
|
|
|
+ text: 'About',
|
|
|
+ },
|
|
|
+ },
|
|
|
+ {
|
|
|
+ type: 'context',
|
|
|
+ elements: [
|
|
|
+ {
|
|
|
+ type: 'mrkdwn',
|
|
|
+ text: 'Psssst',
|
|
|
+ },
|
|
|
+ ],
|
|
|
+ },
|
|
|
+ ],
|
|
|
+ },
|
|
|
+ });
|
|
|
|
|
|
-
|
|
|
-}
|
|
|
+ console.log('openModal');
|
|
|
+};
|