help.js 1.1 KB

1234567891011121314151617181920212223242526272829303132
  1. /*
  2. * !!help command and its message text must exist only in growi app package!!
  3. * the help message should vary depending on the growi version
  4. */
  5. const { markdownSectionBlock } = require('@growi/slack');
  6. module.exports = (crowi) => {
  7. const BaseSlackCommandHandler = require('./slack-command-handler');
  8. const handler = new BaseSlackCommandHandler();
  9. handler.handleCommand = async(growiCommand, client, body, respondUtil) => {
  10. const appTitle = crowi.appService.getAppTitle();
  11. const appSiteUrl = crowi.appService.getSiteUrl();
  12. // adjust spacing
  13. let message = `*Help* (*${appTitle}* at ${appSiteUrl})\n\n`;
  14. message += 'Usage: `/growi [command] [args]`\n\n';
  15. message += 'Commands:\n\n';
  16. message += '`/growi note` Take a note on GROWI\n\n';
  17. message += '`/growi search [keyword]` Search pages\n\n';
  18. message += '`/growi keep` Create new page with existing slack conversations (Alpha)\n\n';
  19. await respondUtil.respond({
  20. text: 'Help',
  21. blocks: [
  22. markdownSectionBlock(message),
  23. ],
  24. });
  25. };
  26. return handler;
  27. };